Actions · 3 parts · 5 states · Basic

Toggle Button

A button that stays pressed or not: it switches a state that lasts.

01Anatomy

Following

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 or aria-pressed does (WAI-ARIA APG).

02Structure

  • Toggle Buttoncomponent setauto layouthorizontalhugH 44padding H 16gap 8
  • Iconinstanceswaps with Pressed
  • Labeltextboolean
Structure
PropertyTypeValues
PressedVarianttruefalse
StateVariantDefaultHoverFocusDisabled
Icon onlyBooleantruefalse
LabelText“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

OffNot pressed. Looks like a secondary button.
HoverThe pointer is over it. Fill and border get a bit stronger.
OnPressed, and it stays so. Fill, border and icon change together.
FocusReached with the keyboard: a ring on top of its current state.
DisabledCan’t be changed now. Keep the on or off look readable.

04Variants

With labelIcon and text, like Follow or Favourite.
Icon-onlyOnly the icon, in toolbars. It needs an accessible name and usually a tooltip.
GroupSeveral independent toggles side by side: Bold, Italic, Underline.
SegmentedOnly one on at a time, like Grid or List. It behaves like a radio group.

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.

Fuori Frame

Proven methods for designing interfaces with AI. Every two weeks, in Italian.

Subscribe