Checkbox
A toggle control that represents a checked or unchecked state.
A controlled checkbox. Pair value with onValueChange to manage state from React.
Usage
Basic checkbox
import { useState } from 'react';
import { Host, Checkbox } from '@expo/ui';
export default function CheckboxExample() {
const [accepted, setAccepted] = useState(false);
return (
<Host matchContents>
<Checkbox label="I accept the terms" value={accepted} onValueChange={setAccepted} />
</Host>
);
}Disabled
import { Host, Checkbox } from '@expo/ui';
export default function DisabledCheckboxExample() {
return (
<Host matchContents>
<Checkbox label="Locked option" value onValueChange={() => {}} disabled />
</Host>
);
}API
import { Checkbox } from '@expo/ui';Component
Checkbox
Type: React.Element<CheckboxProps>
A toggle control that represents a checked or unchecked state.
Props for the Checkbox component.
CheckboxProps
disabled
Optional • Type: boolean
Whether the checkbox is disabled. Disabled checkboxes do not respond to user interaction.
label
Optional • Type: string
Text label displayed alongside the checkbox.
modifiers
Optional • Type: ModifierConfig[]
Platform-specific modifier escape hatch. Pass an array of modifier configs from @expo/ui/swift-ui/modifiers or @expo/ui/jetpack-compose/modifiers.
onValueChange
Type: (value: boolean) => void
Called when the user toggles the checkbox.
testID
Optional • Type: string
Identifier used to locate the component in end-to-end tests.
value
Type: boolean
Whether the checkbox is checked.
Modifiers
Use these modifiers in the modifiers prop of the Universal version.
Modifiers for Checkbox
Modifiers for any view
accessibilityAddTraitsaccessibilityElementaccessibilityHiddenaccessibilityHintaccessibilityIdentifieraccessibilityInputLabelsaccessibilityLabelaccessibilityRemoveTraitsaccessibilityValueactivityBackgroundTintalignmentGuideallowsTighteninganimationaspectRatiobackgroundbackgroundOverlayblurboldborderbrightnessclippedclipShapecolorInvertcontainerBackgroundcontainerRelativeFrameiOS 17+containerShapecontentShapecontentTransitioniOS 16+contrastcornerRadiuscreateModifierdisableddynamicTypeSizeenvironmentfixedSizefontforegroundColorforegroundStyleframegeometryGroupiOS 17+glassEffectglassEffectIdgrayscalegridCellAnchoriOS 16+gridCellColumnsgridCellUnsizedAxesgridColumnAlignmentiOS 16+hiddenhueRotationidignoreSafeAreaimageScaleinvalidatableContentiOS 17+italickerninglayoutPrioritylineHeightiOS 26+lineLimitlineSpacingluminanceToAlphamaskmatchedGeometryEffectminimumScaleFactormonospacedDigitmultilineTextAlignmentoffsetonAppearonDisappearonGeometryChangeonLongPressGestureonTapGestureopacityoverlaypaddingprivacySensitiveredactedrotation3DEffectrotationEffectsaturationscaleEffectshadowstrikethroughstrokeBordertextCasetinttruncationModeunderlineunredactedwidgetURLzIndex
Sources
The original Expo docs for this page:
- Checkbox (Universal) (
source-of-truth/versions/v57.0.0/sdk/ui/universal/checkbox.md)