- Notifications
You must be signed in to change notification settings - Fork32
Override option text color in a select component#307
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 1 comment
-
The easiest way to implement this is using the <SelectchakraStyles={{container:(provided)=>({ ...provided,color:"black",}),}}/> This will also ensure that the controls (clear button and dropdown arrow) also inherit this color: ![]() Now, if you're happy with the main control component becoming black when you focus it, this is all you need (you didn't mention anything about this). But it does make things very hard to see, so if you'd like to keep that light colored when you focus as well, add this to your <SelectchakraStyles={{container:(provided)=>({ ...provided,color:"black",}),control:(provided)=>({ ...provided,_focusVisible:{bg:"white",},}),}}/> This will ensure that everything is equally visible when your component is focused: ![]() Here's a complete CodeSandbox example:https://codesandbox.io/p/sandbox/w9jf8j?file=%2Fcomponents%2Fselect-choc.tsx And next time you have a question, it would be great if you could provide a CodeSandbox with a complete example with your question. It's much easier to provide help if I have a complete example of what you've tried to go off of. |
BetaWas this translation helpful?Give feedback.