Go Main page
Go Main page

Web components

cover

components

Toggle

v.1.0.0 | Saturn

Switch the state of a single item on/off.

Component

Play with the component with our playground.

Anatomy

Foo

NameDescription

1

Container
Required
width
92px -
height
24px - _radius_ _radius_50_.

2

Thumb
Required
height
and
width
20px.

3

Vector
Required
Indicates the on state. Icon
height
12px.

Foo

NameDescription

1

Container
Required
Background color may vary according to design needs.
width
and
height
fluid (100% bounded by parent element)..

2

Thumb
Required
height
and
width
20px.

3

Label
Required
Indicates the yes or no state.

States and Variants

  • On: Displays the toggle in the on state.
  • Off: Displays the toggle in the off state.
  • Unset: Displays the default toggle not activated or activated by the user.
  • Keyboard focus: A keyboard focus state communicates when a user has highlighted an element, using an input method such as a keyboard or voice.

Simple

Foo

On-off

Foo

Keyboard interaction

  • Activate and deactivate by keyboard

For users who only use the keyboard and screen readers, it should be possible to enable and disable the toggle.

Toggles the thumb between on and off states with Space / Enter keys.

Foo

Behaviours

On/Off state

  • Clicking or tapping on the toggle activates or deactivates it.
  • Vertical grouping

  • They will be aligned vertically respecting a spacing of 16px.
  • Label alignment

  • The toggles will always go with a label, but the location of this can vary and will depend on the block, molecule or row where it is located, therefore it will not be defined in this basic component. If we define that when placing a label the minimum distance to respect is 16px.
  • Right alignment

  • When displaying a list of options with a toggle, each line will fit the full width of the screen and the toggle should always be aligned to the right.
  • Do's and dont's

    Foo

    Do’s

    Keep labels short and direct. A label should describe what the control does when the switch is on.

    Foo

    Don’t

    Do not add long and unintuitive texts that can be confusing for the user.

    Foo

    Do’s

    The labels will always go to the left of the toggles.

    Foo

    Don’t