I want to change the color and background color of the Base Web Button component on button click using React. How can I change the styles of the button on button click?
I tried to use $isSelected
prop to detect clicking, but this didn't help me. Here is the code:
import { Button } from 'baseui/button'
...
<Button
kind="secondary"
size="compact"
shape="pill"
overrides={{
BaseButton: {
style: ({ $isSelected }) => ({
color: $isSelected ? 'white' : 'black',
backgroundColor: $isSelected ? 'black' : 'white',
}),
},
}}
>
Hello
</Button>
How can I handle it?