CSS Styling Switch Color

Anyone know the css to change the color of a switch?
image

I’m on the business plan.

The above answer is not entirely accurate. You should use this code (note, that it will change the color of all switch components in the app).

.switch-checked .track {
   background-color: red !important;
}

If you only want to change the switch color of one switch, you’ll need to:

  1. first add it to a container (because for whatever reason, the switch component doesn’t have a CSS box)
    image

  2. add a css class to the container (eg. red-switch-box)
    image

  3. edit the above CSS to include the container class like this:

[class*="red-switch-box"] .switch-checked .track {
    background-color: red !important;
}

End result:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.