Repository navigation
change style on focus and disabled options #6027
Unanswered
kimbau-dev
asked this question in
Q&A
Replies: 1 comment
|
Use a CSS Applied to your example: <Select
options={options}
onChange={handleOnChange}
styles={{
option: (base, { isDisabled }) =>
isDisabled
? {
...base,
':hover': {
backgroundColor: '#f5f6f7',
},
}
: base,
}}
/>This changes the background while the pointer is over a disabled option, while preserving the existing styles for enabled options. The option remains disabled; there is no need to make it focusable/selectable merely to get a hover appearance.
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello, I am trying to add a style for when the user hovers over a disabled option. When I log the disabled option and focus state, the focus state only returns true for the first option available. Has any one else found a solution for a similar problem?
Thanks
All reactions