Switch
A toggle switch for boolean inputs.
Installation
import { Switch } from '@smc/darwin-ui';npx shadcn add https://darwin-ui.mandalsuraj.com/registry/switch.jsonUsage
import { Switch } from '@smc/darwin-ui';
export function Example() { const [enabled, setEnabled] = useState(false);
return ( <Switch label="Enable notifications" checked={enabled} onCheckedChange={setEnabled} /> );}API Reference
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | - | Switch label |
checked | boolean | false | Toggle state |
onCheckedChange | (checked: boolean) => void | - | Change handler |
disabled | boolean | false | Disable switch |