Toggle
A two-state button. Pressed state is physical in every style: it latches down.
ActionsRadix Toggle
Needs the @dumb registry in components.json and the style tokens. See Installation.
API reference
Matches shadcn/ui. Native props are forwarded.
Toggle
| Prop | Type | Default |
|---|---|---|
| variant | "default" | "outline"Ghost or outlined key. | "default" |
| size | "default" | "sm" | "lg"Height from --du-h-* tokens. | "default" |
| pressed | booleanControlled pressed state. | - |
| onPressedChange | (pressed: boolean) => voidCalled when the pressed state changes. | - |
- Space
- Toggles the pressed state.
- Enter
- Toggles the pressed state.