Component
Switch
Toggles a setting on or off.
Install
Run the CLI to copy the source into your project.
pnpm dlx @stalk-ui/cli add @stalk-ui/switchExamples
Live previews render through the docs app's PandaCSS codegen.
<Switch aria-label="Email notifications" />
<Switch defaultChecked aria-label="Push notifications" />
<Switch disabled aria-label="Locked setting" />
Props
Public component props extracted from the source TypeScript types.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| `invalid` | `boolean` | No | - | Marks the switch as invalid; sets \`aria-invalid\` and applies invalid styling. |
| `size` | `SwitchSize` | No | - | - |
Variants
Variant axes exposed by the underlying PandaCSS recipe or slot recipe.
| Variant | Values |
|---|---|
| `size` | `sm`, `md`, `lg` |
Registry
Files this component contributes to your registry install.
- Manifest: `/r/switch.json`
- Recipe: `switch`
- Files: `src/components/ui/switch.tsx`