Switch

Switches can be used for controlling features, settings or hardware that have a clear on/off logic.

Examples

Default

Indicator

The indicator can display the on/off icon inside the track. It is optional and can be enabled by adding an element with the class flexy-switch__indicator after the track element. You can customize its icon and color using the tokens described in the customization section at the bottom of this page.

Thumb Icon

In this example, horizontal line and checkmark icons are used, but you can use whatever icon you want.

Disabled

To render a switch as selected by default, add the checked attribute to the <input> element.

Custom

You can use design tokens to customize the appearance of the switch to your preferences. In this example, the switch is customized to look like a Material Design 2 switch.

Customization

Supported Classes

Supported Token

Last modified: Oct 19, 2025: refactor(docs): Reorganize the folder structure of component examples (8271c2e)