Inputs and selection
Checkbox
checked onCheckedChange
function CheckboxDemo() { const [terms, setTerms] = React.useState(true); const [updates, setUpdates] = React.useState(false); const tap = (set: (v: boolean) => void, v: boolean) => () => { Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); set(v); }; return ( <View className="gap-4"> <View className="flex-row items-center gap-3"> <Checkbox id="ks-terms" checked={terms} onCheckedChange={setTerms} /> <Label htmlFor="ks-terms" onPress={Platform.select({ native: tap(setTerms, !terms) })}> Accept terms and conditions </Label> </View> <View className="flex-row items-start gap-3"> <Checkbox id="ks-updates" checked={updates} onCheckedChange={setUpdates} /> <View className="flex-1 gap-1"> <Label htmlFor="ks-updates" onPress={Platform.select({ native: tap(setUpdates, !updates) })}> Product updates </Label> <Text className="text-muted-foreground text-sm">Occasional email about new features.</Text> </View> </View> <View className="flex-row items-center gap-3"> <Checkbox id="ks-disabled" checked={false} disabled onCheckedChange={() => {}} /> <Label htmlFor="ks-disabled" disabled> Disabled </Label> </View> </View> );}Usage
On native the Label needs its own onPress to toggle.
API
<Checkbox checked onCheckedChange disabled? />Get it
Already in every copy of the native kit:
import { Checkbox } from '@/components/ui/checkbox';Details
- Exports
Checkbox- Packages
- @rn-primitives/checkbox@^1.5.2, lucide-react-native@^1.21.0
- Installs with
- @halftone-native/icon, @halftone-native/lib-utils
- Also searched as
- tick, check
- Registry JSON
- /r/native/checkbox.json
<div className="grid gap-3"> {['Product updates', 'Weekly summary', 'Billing alerts'].map((l, i) => ( <div key={l} className="flex items-center gap-2"> <Checkbox id={`demo-cb-${i}`} defaultChecked={i !== 1} /> <Label htmlFor={`demo-cb-${i}`}>{l}</Label> </div> ))}</div>Usage
For picking any number of options. One-of-many is a RadioGroup; never mix the two in one group.
API
<Checkbox id checked onCheckedChange /><Label htmlFor>…</Label>Get it
Already in every copy of the web kit:
import { Checkbox } from '@/components/ui/checkbox';Details
- Exports
Checkbox- Packages
- cn@^0.5.2, lucide-react@^1.52.0, radix-ui@^1.7.0
- Registry JSON
- /r/web/checkbox.json
Agents: the whole registry is at /llms.txt.