Checkbox

The `Checkbox` component allows selecting multiple options from a list. It consists of `Checkbox.Group` and `Checkbox.Item`.


Usage

import { Checkbox } from '@smartacteam/react-native-ui';
<Checkbox.Group
  value={selectedValues}
  onChange={setSelectedValues}
>
  <Checkbox.Item value="beans" label="Beans" />
  <Checkbox.Item value="sausage" label="Sausage" />
  <Checkbox.Item value="cheese" label="Parmesan" />
  <Checkbox.Item value="olive" label="Olives" />
  <Checkbox.Item value="sardine" label="Sardines" />
</Checkbox.Group>

Example

Preview

Checkbox.Group Props

PropTypeDescription
childrenReact.ReactElement<ItemProps>[]List of Checkbox.Item components
valueArray<any>Array of selected values
formNamestringOptional identifier for form integration
errorbooleanIf true, shows description text in error color
descriptionstringText shown below the group; animates color depending on error state
onChange(value: Array<any>) => voidCallback fired when the selection changes
styleViewProps['style']Custom styles for the container

Checkbox.Item Props

PropTypeDescription
labelstringLabel text displayed next to the checkbox
descriptionstringOptional smaller description text below the label
selectedbooleanControlled selected state, usually passed from Checkbox.Group
valueanyValue represented by this checkbox item
colorkeyof GlobalColorsTypeOptional color key for the checkbox border and fill when not selected
activeColorkeyof GlobalColorsTypeOptional color key for the checkbox fill when selected
labelFontWeightTextWeightFont weight of the label text
onChange(selected: boolean, value?: any) => voidCallback fired when this checkbox is toggled
styleTouchableOpacityProps['style']Additional style props

Notes

  • Use Checkbox.Group to manage the list of selected values and pass them down as value prop.
  • Checkbox.Item can be used standalone, but typically controlled by Checkbox.Group.
  • The component uses animated color transitions to indicate error state and selection.
  • formName prop in Checkbox.Group can be used for integration with Form.