useCheckbox

Provides the behavior and accessibility implementation for a checkbox component. Checkboxes allow users to select multiple items from a list of individual items, or to mark one individual item as selected.

Install#

yarn add @react-native-aria/checkbox

Import#

import { useCheckbox } from "@react-native-aria/checkbox";

API#

useCheckbox(props: AriaCheckboxProps, state: ToggleState, inputRef: RefObject): CheckboxAria

AriaCheckboxProps#

ToggleState#

inputRef#

  • A ref for the HTML or Pressable/Touchable element.

CheckboxAria#

{ inputProps: InputHTMLAttributes<HTMLInputElement> & AccessibilityProps }

Props for the input or Pressable/Touchable element.

Example#