Components
iOSAndroid
Installation
pnpm dlx @docyrus/cli add @docyrus/rn-switchUsage
import { Switch } from '@/components/docyrus-native/switch';
<Switch checked={true} onCheckedChange={setChecked} />
<Switch label="Enable notifications" checked={on} onCheckedChange={setOn} />
<Switch size="sm" disabled />API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | false | Switch state |
onCheckedChange | (value: boolean) => void | — | State change handler |
disabled | boolean | false | Disable interaction |
size | 'sm' | 'md' | 'lg' | 'md' | Switch size |
label | string | — | Optional label text |
className | string | — | Additional CSS classes |
labelClassName | string | — | Label CSS classes |
accessibilityLabel | string | — | Accessibility label |
Type Exports
| Type | Description |
|---|---|
SwitchProps | Props for Switch component |
SwitchSize | 'sm' | 'md' | 'lg' |