Skip to main content
  1. Docs
  2. Components
  3. Actions

Toggle

A tool that's pressed or not. With only an icon, its name shows as its tooltip.

Import
@qeetrix/react
Status
StableSince 0.0.2
Renders
<button aria-pressed>Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Keyboard

KeysWhat happens
SpacePresses it, or releases it.
EnterPresses it, or releases it.
TabTabMoves focus to it; an icon-only toggle's tooltip opens.

02

Behaviour

Role and state
A native <button> with aria-pressed: read as a toggle button, on or off.
Name
Its label, or aria-label for an icon alone; that toggle warns in development without one.
Pressed
A fill, not colour alone; forced colours draw it in Highlight.
Focus
A 2px Ember ring on :focus-visible, inside a 1px surface gap.

03

Tested

On every change, before it ships.

  • axe, WCAG 2.2 A and AA, in Chromium on every pull request
  • Firefox and WebKit every night
  • Forced colours, reduced motion and right to left
  • Server rendering
Next — ToggleChangelog