Utility
AI
Terminal
Installation
pnpm dlx shadcn@latest add https://termcn.dev/r/toggle.json
Usage
import { Toggle } from "@/components/ui/toggle";<Toggle checked={enabled} onChange={setEnabled} label="Dark mode" />API Reference
Toggle
| Prop | Type | Default |
|---|---|---|
checked | boolean | undefined |
onChange | (checked: boolean) => void | undefined |
label | string | undefined |
onLabel | string | "ON" |
offLabel | string | "OFF" |
id | string | undefined |
disabled | boolean | false |
checkedIcon | string | "●" |
uncheckedIcon | string | "○" |
borderStyle | "single" | "double" | "round" | "bold" | "singleDouble" | "doubleSingle" | "classic" | "round" |
paddingX | number | 1 |