Skip to content
Alea0.1

Forms

Switch

An on/off setting that applies right away.

Ant Design: Switch

import { Switch } from '@alea/ui';

Examples

Switch

Applies right away.

Settings rows

Label on the left for lists of settings.

Props

Switch props

An on/off setting that applies right away.

PropTypeDefaultDescription
descriptionReactNode-Help text under the label.
labelPosition"start" | "end"'end'Label on the left (settings rows) or the right (default).
size"sm" | "md"'md'sm (32 × 20) or md (40 × 24, default).

Accessibility

  • Role switch: announced as on or off.

Keyboard

KeyDoes
SpaceToggles it

Do and don't

Do

  • Name what is turned on, not the action: Dark mode.

Don't

  • Don't use in a form that needs Save: use Checkbox.
Tested with axe, keyboard and screen reader roles