Skip to content
Stylhero 0.6.2
React Native

Theme

Core

Feedback

Inputs

Navigation

Overlays

React Native / Inputs

Checkbox

Checkbox with its label. The whole row is the touch target (at least 44pt high).

import { Checkbox } from "@stylhero/native";

Example

import { useState } from "react";
import { Checkbox } from "@stylhero/native";

function CheckboxExample() {
  const [agree, setAgree] = useState(false);
  return <Checkbox label="Include used parts" description="From sellers rated 4 stars or more" checked={agree} onChange={setAgree} />;
}

Props

PropTypeDefaultDescription
checked required boolean | "mixed" - "mixed" shows a dash, e.g. for "select all" when only some rows are selected.
label required string -
onChange required (checked: boolean) => void - Called with the new value. From "mixed" a press checks the box.
description string -
disabled boolean -
error string - Error message. Turns the box red and is read with the checkbox.
ref Ref<ComponentRef<typeof View>> -
style StyleProp<ViewStyle> -
testID string -

Screen reader gestures

Gesture (VoiceOver / TalkBack)Does
Double-tapToggles it

Accessibility

  • A checkbox, read as checked, not checked or mixed. description and error are its hint.
  • The whole row (control, label and description) is one touch target and is read as one element.

Generated from src/components/Checkbox.tsx. Something wrong or missing? Open an issue.