Dinachi

Toggle

A toggle button component that can be switched between pressed and unpressed states. Supports multiple variants and sizes.

#Installation

npx @dinachi/cli@latest add toggle

#Usage

tsx
import { Toggle } from '@/components/ui/toggle'

#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
pressedbooleanThe controlled pressed state of the toggle
defaultPressedbooleanfalseThe default pressed state when uncontrolled
onPressedChange(pressed: boolean) => voidCallback fired when the pressed state changes
disabledbooleanfalseWhether the toggle is disabled