Inputs and selection
Switch
settings on/off
function SwitchDemo() { const [checked, setChecked] = React.useState(true); const flip = (v: boolean) => { Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); setChecked(v); }; return ( <View className="flex-row items-center gap-3"> <Switch checked={checked} onCheckedChange={flip} id="ks-switch" /> <Label htmlFor="ks-switch" onPress={() => flip(!checked)}> Notifications </Label> </View> );}Usage
Settings-style on/off. For an action, use Toggle instead.
API
<Switch checked onCheckedChange />Get it
Already in every copy of the native kit:
import { Switch } from '@/components/ui/switch';Details
- Exports
Switch- Packages
- @rn-primitives/switch@^1.5.2
- Installs with
- @halftone-native/label, @halftone-native/lib-utils
- Also searched as
- toggle, on off
- Registry JSON
- /r/native/switch.json
<div className="flex items-center gap-3"> <Switch id="demo-switch" defaultChecked /> <Label htmlFor="demo-switch">Email notifications</Label></div>API
<Switch id checked onCheckedChange />Get it
Already in every copy of the web kit:
import { Switch } from '@/components/ui/switch';Details
- Exports
Switch- Packages
- cn@^0.5.2, radix-ui@^1.7.0
- Registry JSON
- /r/web/switch.json
Agents: the whole registry is at /llms.txt.