
Pressable toggle button with on/off state.
npx shadcn@latest add https://ui.edbn.me/r/toggle.jsonA toggle button that can be on or off. Renders a button element.
defaultPressedbooleanfalseInitial pressed state
pressedbooleanControlled pressed state
onPressedChangefunctionCalled when state changes
disabledbooleanfalseDisable toggle
nativeButtonbooleantrueRender as native button
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-pressed | Present when toggle is on |
| data-disabled | Present when toggle is disabled |