Skip to content

How do I change color of singleValue when hovering on control? #4691

Answered by Rall3n
cpnvr asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @cpnvr,

I would suggest a combination of classNamePrefix and the styling api.

You use the classNamePrefix prop to apply fixed classes to the inner components (SingleValue would have PREFIX__single-value). With this you can apply a :hover style onto the Container component to target the SingleValue by class.

<Select
    classNamePrefix='select'
    styles={{
        container: (provided) => ({
            ...provided,
            '&:hover .select__single-value': {
                color: 'red'
            }
        })
    }}
/>

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@cpnvr
Comment options

@Rall3n
Comment options

@cpnvr
Comment options

@Rall3n
Comment options

Answer selected by cpnvr
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants