Switch
StableToggle switches for binary on/off settings with smooth animations.
Import
import { Switch } from '@brutal-ui/react';Basic Usage
const [enabled, setEnabled] = useState(true);
<Switch
checked={enabled}
onChange={(e) => setEnabled(e.target.checked)}
label={`Notifications (${enabled ? 'ON' : 'OFF'})`}
/>Without Label
<Switch checked={true} onChange={() => {}} />Multiple Switches
Disabled State
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | false | Controlled checked state |
| onChange | function | - | Change event handler |
| label | string | - | Label text |
| disabled | boolean | false | Disable switch |