This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 57).
Expo Checkbox
A universal React component that provides basic checkbox functionality.
expo-checkbox provides a basic boolean input element for all platforms.
Installation
- npx expo install expo-checkboxUsage
import { Checkbox } from 'expo-checkbox'; import { useState } from 'react'; import { StyleSheet, Text, View } from 'react-native'; export default function App() { const [isChecked, setChecked] = useState(false); return ( <View style={styles.container}> <View style={styles.section}> <Checkbox style={styles.checkbox} value={isChecked} onValueChange={setChecked} /> <Text style={styles.paragraph}>Normal checkbox</Text> </View> <View style={styles.section}> <Checkbox style={styles.checkbox} value={isChecked} onValueChange={setChecked} color={isChecked ? '#4630EB' : undefined} /> <Text style={styles.paragraph}>Custom colored checkbox</Text> </View> <View style={styles.section}> <Checkbox style={styles.checkbox} disabled value={isChecked} onValueChange={setChecked} /> <Text style={styles.paragraph}>Disabled checkbox</Text> </View> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, marginHorizontal: 16, marginVertical: 32, }, section: { flexDirection: 'row', alignItems: 'center', }, paragraph: { fontSize: 15, }, checkbox: { margin: 8, }, });
An example of how expo-checkbox appears on Android and iOS is shown below:
API
import { Checkbox } from 'expo-checkbox';
Component
Type: React.Element<CheckboxProps>
ColorValueThe tint or color of the checkbox. This overrides the disabled opaque style.
booleanIf the checkbox is disabled, it becomes opaque and uncheckable.
(event: NativeSyntheticEvent<CheckboxEvent> | SyntheticEvent<HTMLInputElement, CheckboxEvent>) => voidCallback that is invoked when the user presses the checkbox.
event: NativeSyntheticEvent<CheckboxEvent> | SyntheticEvent<HTMLInputElement, CheckboxEvent>A native event containing the checkbox change.
(value: boolean) => voidCallback that is invoked when the user presses the checkbox.
value: booleanA boolean indicating the new checked state of the checkbox.
boolean • Default: falseValue indicating if the checkbox should be rendered as checked or not.