Design System
Buttons

Toggle

A two-state button that stays pressed. Use it for a setting that takes effect immediately, not as a substitute for a checkbox in a form.

Purpose

A Toggle is a button that holds its pressed state — formatting controls, view options, filter chips. It keeps button semantics (aria-pressed), so it reads as "this button is on", not "this field is ticked".

Use it for

  • Formatting controls in a toolbar (bold, italic)
  • View options that apply immediately (compact rows)
  • Filter chips that narrow a list in place

Reach for something else

Icon toggles

The classic toolbar use. Icon-only toggles must carry an aria-label.

Outline, with label

The outline variant carries a border and works as a filter chip with a text label.

Sizes

Three sizes matching Button's heights; each keeps a square minimum width for icon-only use.

States

Pressed is --accent fill; the label never changes with the state.

Control it when something else reacts to the state:

Controlled toggle
const [bold, setBold] = React.useState(false);

<Toggle aria-label="Bold" pressed={bold} onPressedChange={setBold}>
  <Glyph symbol="format_bold" />
</Toggle>

Structure

PropertyValue
Height40px default · 32px sm · 44px lg, with a matching square min-width
Padding12px default · 8px sm · 16px lg horizontal
Typography14px / Inter 500 (text-sm font-medium); glyphs at 1.2em
Radius--radius-md (6px)
Pressed--accent fill with --accent-foreground ink (data-state=on)
Hover--muted fill (default) · --accent (outline)
Outline1px --input border, --shadow-1
Focus2px --ring
Disabled50% opacity, pointer events off

Best practices

Do

  • Give icon-only toggles an aria-label — always.
  • Label the thing being toggled ("Bold", "Favourites"), and keep the label constant — aria-pressed carries the state.
  • Apply the effect immediately; a toggle is not a staged form input.
  • Group related toggles in one toolbar row so they read as a set.

Don't

  • Swap the label with the state ("Show" ↔ "Hide") — screen readers then hear a contradiction between label and pressed state.
  • Use it inside a form for consent or options — that is Checkbox.
  • Use it for navigation or a one-shot action — that is Button.
  • Rely on colour alone to distinguish pressed in a dense toolbar — the outline variant keeps a visible boundary.

Accessibility & keyboard

  • Real <button> semantics with aria-pressed reflecting the state — provided by Radix Toggle.
  • Icon-only toggles require aria-label; the label must not describe the state.
  • Focus shows the 2px --ring outline — never remove it.
  • Keyboard: Tab to focus; Enter or Space toggles.

Props

Toggle also accepts every native <button> attribute, plus Radix's pressed, defaultPressed and onPressedChange.

PropTypeDefaultDescription
asChildboolean | undefined——
pressedboolean | undefined—The controlled state of the toggle.
defaultPressedboolean | undefinedfalseThe state of the toggle when initially rendered. Use `defaultPressed` if you do not need to control the state of the toggle.
onPressedChange((pressed: boolean) => void) | undefined—The callback that fires when the state of the toggle changes.
variant"default" | "outline" | null | undefined——
size"default" | "sm" | "lg" | null | undefined——

On this page