ComponentsSwitch

formstexulinot agent-emittableapp

Switch

switch

An immediate on/off setting control.

Live examples

Labeled switch

Labeled switch

Loading demo…

Props

Public props for Switch
NameKindRequiredDefaultDescription
checkedbooleannofalse—
defaultCheckedbooleannofalse—
namestringno——
valuestringno"on"—
disabledbooleannofalse—
requiredbooleannofalse—
idstringno——
labelstringno——
descriptionstringno——
sizeenum (sm, md)no"md"—
onCheckedChangeeventno——
classstringno——

Keyboard

Keyboard behavior for Switch
KeyAction
—See accessibility notes for keyboard behavior.

Accessibility

  • role=switch with aria-checked; label wires the accessible name.

Evidence for switch

Latest committed gates for switch (as of 2026-10-23). Static snapshot — not live CI.

Behavior

checkedscenario switch

6 checks

Rows in tests/behavior/scenarios/switch.spec.ts, held to the WAI-ARIA APG pattern, run on Chromium, WebKit and the Pixel 7.

Size (gzip)

@texuli/primitives/switch · budget 4.00 KiB

Budget from texuli.budgets.json; re-measure with `pnpm size --filter <entry>`.

Axe

documented

  • tests/e2e/site-component-pages.spec.ts
  • docs/quality (a11y-*)

Site component pages axe gate; package-level a11y docs under docs/quality when present.

Browsers

  • chromium
  • webkit
  • mobile

Playwright projects: Desktop Chrome, Desktop Safari, Pixel 7. Firefox is a known gap on this host.

When to use

Use when

  • Settings that take effect immediately

Don’t use when

Prefer another component

  • A form agreement that must be submitted (use checkbox)