#Changing Switch component Styles doesn't work

7 messages · Page 1 of 1 (latest)

valid sedge
#

You will need to change styles, styles api was changed to support on and off labels as React node

native topaz
#

It should probably be backgroundColor instead of background.
You can probably right-click, inspect element to figure out which selectors to target.

patent crescent
#

you're using &:checked on the track but it would never have that property

#

I haven't test it, but you want to target input:checked then track

#
styles={{
            input: {
            '&:checked': {
              '+ .mantine-Switch-track': {
                backgroundColor: 'red'
              }
            }
          }}}```
#

or


input: {
            '&:checked + .mantine-Switch-track': {
              
                backgroundColor: 'red'
              
            }```
#

^ these are tested and work