Skip to content

Toggle and segmented control

A pressed/unpressed button, and a segmented control for a few mutually exclusive modes.

npx dtheo@latest add toggle
Step responseR-0412 · Bench 3

0–400 ms: peaks 17.6 % over at 61 ms, settles by 182 ms.

When to use

  • Switching a view or time window (400 ms / 1 s)
  • Turning a display option on in a toolbar
  • Settings that persist: use Switch
  • More than five options: use Select

Keyboard

Arrow keys
Move between segments
EnterSpace
Selects the focused segment
  • Give the group an aria-label that names what it switches ("Time window").

Used in