Chakra-UI Menu colors override causes breaking of selected item colors fix #274
Answered
by
csandman
intivillca
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
csandman
Aug 2, 2023
Replies: 1 comment 5 replies
-
It's hard to tell exactly what the issue is, but it seems to be a problem with certain styles getting priority where they shouldn't be. Which style specifically is not working right? Should the Nizak option at the bottom have a lighter background color? And a couple follow up questions:
Also, do you think you could provide a reproduction in CodeSandbox? I'd be happy to take a more in depth look but it's hard to tell exactly what's going on without that. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok I actually have an alternative solution that could work for you! I was looking at Chakra's own Menu component and wondering why the
_dark
styles they have applied don't override the style props orsx
props you add directly to the components. Like this, where I'm focusing the menu item:And I checked the styles and realized, that's probably the whole reason they started using the
cssVar
utility function to add component scoped css variables. When you add a custom style on the component itself, it just overrides the base style which was previously referencing the css variable.Before the custom style
After the custom style
If you take a look at their theme file for the
Menu
, you can s…