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/switch

Examples

Live previews render through the docs app's PandaCSS codegen.

Theme
<Switch aria-label="Email notifications" />
Theme
<Switch defaultChecked aria-label="Push notifications" />
Theme
<Switch disabled aria-label="Locked setting" />

Props

Public component props extracted from the source TypeScript types.

PropTypeRequiredDefaultDescription
`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.

VariantValues
`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`