On this page

Toggle button

When to use toggle button, its parts, states, keys and accessibility.

Draft. Proposed from the survey of 18 design systems and not yet approved. It is in the registry so teams can try it; the API may still change before approval.

When to use

  • To turn a mode or a view option on and off in a toolbar or above a list: Pin, Show only errors, Wrap lines.

When not to use

  • For a setting that is saved, such as in a settings form. Use a switch.
  • To choose one option out of several. Use a segmented control.

States

State Look
Off The Default or Subtle button at rest
On Fill button.background.selected (graphite 5) and border button.border.selected (color.border.bold), D15
Hover, pressed, focus, disabled As Button. An on button keeps its fill on hover

The on fill is two steps above the button hover, so an on button never looks like a hovered one. The bold border is the second cue, so the state never depends on fill alone.

Content

The label stays the same in both states, such as “Pin”. Change the icon if it helps (an outlined and a filled pin), never the meaning of the label.

Accessibility

  • aria-pressed="true" or "false". Screen readers announce “toggle button, pressed”.
  • Text on the on fill: 8.94:1 in light, 8.37:1 in dark. The bold border reaches 4.34:1 in light and 4.51:1 in dark against the surface.