Skip to content
  • System
  • Light
  • Dark
  • High contrast

Switch

import { Switch } from '@eekodigital/raster';

<Switch.Root>
  <Switch.Thumb />
</Switch.Root>
<Switch.Root defaultChecked>
  <Switch.Thumb />
</Switch.Root>
<label style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
  Enable notifications
  <Switch.Root name="notifications">
    <Switch.Thumb />
  </Switch.Root>
</label>
<Switch.Root disabled>
  <Switch.Thumb />
</Switch.Root>
PropTypeDescription
checkedbooleanControlled on/off state.
defaultCheckedbooleanInitial state (uncontrolled).
onCheckedChange(checked: boolean) => voidCalled when state changes.
disabledbooleanDisables the switch.
namestringForm field name.