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 toggle

Run 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

PropTypeDefaultDescription
variant
'default' | 'outline''default'The visual style variant of the toggle
size
'default' | 'sm' | 'lg''default'The size of the toggle
pressed
booleanThe pressed state of the toggle
defaultPressed
booleanfalseThe default pressed state
onPressedChange
(pressed: boolean) => voidCallback fired when the pressed state changes
disabled
booleanfalseWhether the toggle is disabled