Skip to content

Checkbox Primitive

A box that is a checked (ticked) indicator when activated.

Installation

Install the component via your command line.

Terminal window
npx expo install @rn-primitives/checkbox

Usage

import * as CheckboxPrimitive from '@rn-primitives/checkbox';
function Example() {
const [checked, setChecked] = React.useState(false);
return (
<CheckboxPrimitive.Root checked={checked} onCheckedChange={setChecked}>
<CheckboxPrimitive.Indicator style={{ height: 4, width: 4, backgroundColor: 'red'}} />
</CheckboxPrimitive.Root>
);
}

Props

Root

Extends Pressable props

PropTypeNote
checked*boolean
onCheckedChange*(checked: boolean) => void
disabledboolean(optional)

Indicator

Extends View props

PropTypeNote
forceMounttrue | undefined(optional)