Toggle

An icon button for a binary action state. Toggle changes both its icon and emphasis while preserving one stable accessible label.

Props

PropTypeRequiredDescription
labelstringYesStable accessible name for the action
valuebooleanYesWhether the toggle is on
onValueChange(value: boolean) => voidYesCalled with the next state
onIconIconTypeYesIcon displayed when on
offIconIconTypeYesIcon displayed when off
barebooleanNoRemoves the button surface
disabledbooleanNoDisables interaction
jssJSSNoExceptional style overrides

Basic usage

Notifications off
const [notifications, setNotifications] = useState(false);

<Toggle
  label="Notifications"
  value={notifications}
  onValueChange={setNotifications}
  onIcon="bell-ring"
  offIcon="bell-off"
/>;

States

Bare treatment

Use bare when the toggle sits in application chrome or another surface that already communicates its boundary. Bare toggles remain accent-neutral in both states; the icon and aria-pressed communicate the state without introducing a blue action color.

<Toggle
  bare
  label="Dark mode"
  value={darkMode}
  onValueChange={setDarkMode}
  onIcon="sun"
  offIcon="moon"
/>

Accessibility

Toggle renders a native button with aria-pressed. Keep label stable between states; assistive technology announces the pressed state separately.