How do I access the colors of the theme through using sx?
I tried below but it doesn't work.
<Card
sx={{
border: "2px solid primary.main",
}}
>
As an alternative, you should be able to do:
<Card sx={{border: "2px solid", borderColor: "primary.main"}}>
The shorthand "border" doesn't seem to access the theme colors properly. Hope that's helpful.
Update: Just wanted to add to this that you could also use a function value to set the border color according to your theme.
<Card sx={{border: "2px solid", borderColor: (theme) => theme.palette.primary.main}}>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With