React Native · Components
Checkbox
Checkbox (16 px box, same look as web).
2 exports
Live example
The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.
Preview
Code
Events
- Events appear here when you interact with the preview.
Import
Checkbox
componentCheckbox (16 px box, same look as web). Can be used with a label, description and error message; the touch target is at least 44 px.
Examples
CheckboxProps
interfaceProps of Checkbox.
| Name | Type | Default | Description |
|---|---|---|---|
ref? | Ref<ViewRef> | Ref of the underlying native element. | |
checked? | boolean | Checked (controlled). | |
defaultChecked? | boolean | false | Initially checked (uncontrolled). |
onCheckedChange? | (checked: boolean) => void | When the state changes. | |
indeterminate? | boolean | Partially selected (e.g. a "select all" box): a dash is shown. | |
label? | ReactNode | Label next to the box; all of it is tappable. | |
description? | ReactNode | Description below the label. | |
error? | ReactNode | Error message; the box is drawn in the danger color. | |
disabled? | boolean | Disabled. | |
name? | string | Name in the form. Inside Form, state, error and disabled come from the form. | |
accessibilityLabel? | string | Screen reader label (if the label is not text). | |
effect? | EffectProp | Effect of the box ("ripple", "bounce", "pulse"…). If omitted, appearance.defaults.checkbox.effect. See BuiltinEffect. | |
tooltip? | TooltipProp | Tooltip shown on press and hold. See TooltipProp. | |
style? | StyleProp<ViewStyle> | Container style. |