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.
| Prop | Type | Default | Description |
|---|---|---|---|
description | ReactNode | - | 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
| Key | Does |
|---|---|
| Space | Toggles 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.