Dash mantine components] change background color of dmc.Switch


there’s a way to change the background color of dmc.Switch when turn to "offlabel " ?

it’s similar to this [dash mantine components] change the background color of selected tabs but for dmc.Switch


Hello @jp123 and welcome to the forum!

Actually it is really easy with styles API. Just add

styles={"track": {"background-color": "#0055b3", "border": "#003d80"}}

to your dmc.Switch code.

To construct this you just need to find the right selector using developer console (F12). In this case the name of selector is .mantine-Switch-track and then just pass the correct name from documentation into styles api and change parameters you need :slight_smile: .

More about styles API here: Dash

1 Like

hello @martin2097

that’s works,

thanks !!

1 Like