Toggle Button
A button that stays pressed or not: it switches a state that lasts.
01Anatomy
3 parts. Select a number or a name to see what each part does.
01 · Container
The button. Fill and border change clearly between off and on.
- Required
- Yes
- Recommended
- The two states must differ in more than colour: fill, border or icon.
02 · Icon
Often changes with the state: outline when off, filled when on.
- Required
- No
03 · Label
Names the state or the action. Some systems change it (“Follow” → “Following”), others keep it fixed.
- Required
- Yes
- When
- Only icon-only toggles drop it, and then they need an accessible name.
- Recommended
- If the label changes, don’t also use
aria-pressed: a screen reader would announce something like “Following, pressed”, which is ambiguous. Either the label changes oraria-presseddoes (WAI-ARIA APG).
Example spacing, measured on this drawing (16 px = 1 em). A common implementation, not a rule: values change from system to system. W and H are width and height, as in Figma: Hug follows the content, Fill takes the space of the parent.
Spacing is measured on the normal view: switch back to Normal to show it.
02Structure
- Toggle Buttoncomponent setauto layouthorizontalhugH 44padding H 16gap 8
- Iconinstanceswaps with Pressed
- Labeltextboolean
| Property | Type | Values |
|---|---|---|
| Pressed | Variant | truefalse |
| State | Variant | DefaultHoverFocusDisabled |
| Icon only | Boolean | truefalse |
| Label | Text | “Follow” |
Make Pressed a variant, not a Boolean: off and on change fill, border and icon together. In a prototype, Change to on click swaps them.
03States
04Variants
There is no single correct anatomy: names, variants and properties differ from one design system to another. These are common structural models distilled from established design systems and accessibility guidance.
Proven methods for designing interfaces with AI. Every two weeks, in Italian.
Subscribe