Skip to content

ToggleButton

A button that stays on or off, for view options such as wrapping lines or showing only your items. Use a Switch for settings that save.

  • ToggleButton

PreviewLink to the section Preview

Live in all three themes. Everything here is interactive.

Light theme, ToggleButton

Outline

Ghost, small

Dark theme, ToggleButton

Outline

Ghost, small

High contrast theme, ToggleButton

Outline

Ghost, small

UsageLink to the section Usage

tsx
import { ToggleButton } from '@skribly/ui/actions'
tsx
<ToggleButton isSelected={wrap} onChange={setWrap}>
  <WrapText aria-hidden />
  Wrap lines
</ToggleButton>

Every label is a prop, so the app passes its own words in its own language. See no built-in text.

AccessibilityLink to the section Accessibility

  • Exposes aria-pressed, so screen readers say "pressed" or "not pressed".
  • Space or Enter toggles it.
  • The on state changes fill and border width, never colour alone, and uses the system highlight in forced colours.

This demo runs through axe in all three themes on every test run. See what the tests check.

Search this site

Arrows move through the results, Enter opens one, Esc closes. Ctrl K /