Documentation
Getting Started
Foundations
Form
Layout
Display
Navigation
Overlay
Feedback
Toggle
Form
A two-state button that can be either on or off. Perfect for settings, filters, and boolean controls with visual feedback.
Installation
bash
1npx @dinachi/cli@latest add toggleRun the CLI command above to automatically install the component and its dependencies.
Examples
Default Toggle
A basic toggle button
Toggle Variants
Different toggle variants
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'default' | 'outline' | 'default' | The visual style variant of the toggle |
size | 'default' | 'sm' | 'lg' | 'default' | The size of the toggle |
pressed | boolean | — | The pressed state of the toggle |
defaultPressed | boolean | false | The default pressed state |
onPressedChange | (pressed: boolean) => void | — | Callback fired when the pressed state changes |
disabled | boolean | false | Whether the toggle is disabled |