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