Hextech UI

Switch

Live example

Switch

Installation

Terminal
npx shadcn@latest add https://hextech-ui.vercel.app/r/switch.json

API reference

These are the main Switch options. See the exported TypeScript types for inherited native or primitive props.

PropTypeDefault
checked / defaultCheckedbooleanfalse
onCheckedChange(checked, details) => void—
childrenmanaged indicator/track; use an external labelnot accepted

Checked state

Use checked with onCheckedChange, or defaultChecked for local state. Place a visible label outside Switch. Use it for an immediately applied setting; keep form submission behavior explicit through name.