Switch
A control that allows the user to toggle between checked and not checked.
Installation
pnpm add @heyramzi/ui bits-uiUsage
import { Switch } from "@heyramzi/ui/shadcn/switch";Keyboard and accessibility
| Key | Does |
|---|---|
| Space Enter | Turns the switch on or off. |
- It's a switch that reports on or off. Tie a Label to it so it has a name.
API reference
size"sm" | "default"- Default
"default" refbindableHTMLElement | null- Default
null classstringcheckedbindableboolean- Default
false ...rest- Every prop of
Switch.Rootfrombits-uiexceptchild, children
| Prop | Type | Default |
|---|---|---|
size | "sm" | "default" | "default" |
ref bindable | HTMLElement | null | null |
class | string | |
checked bindable | boolean | false |
...rest | Every prop of Switch.Root from bits-ui except child, children | |