Checkbox Field
- Stable
- WCAG 2.2 evidence
- RTL
A checkbox with a label and optional helper text: the box (the same element as Checkbox)
followed by the label and description, applied on submit. The whole row, description included, is one <label>, so
a click or tap anywhere on it toggles the box (WCAG 2.5.8); Tab focuses the native input and Space toggles it (2.1.1).
The label alone is the accessible name and the description and error are linked with aria-describedby (1.3.1,
4.1.2); checked and indeterminate are shown by a check mark and a dash (1.4.1); errors are text with an icon (3.3.1).
Keyboard focus draws a ring around the row and the box. Consumer duties: label wording (positive statements, parallel grammar in a group) and error wording. Group related
fields in a CheckboxGroup; use Switch for settings that apply immediately.
import { CheckboxField } from "@nexera-ui/react";- 6
- examples
- 29
- props
- 7
- live controls
- 1
- platform
- 11
- WCAG criteria
- 8
- blocks use it
Try every prop. Copy the code.
Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.
import { CheckboxField } from "@nexera-ui/react";
<CheckboxField />Examples 5
The same examples as Storybook, rendered live. Open Code to copy one.
Values
Figma Value: Unchecked, Checked and Indeterminate. Hover, press and Tab to the rows to see the other states.
import { CheckboxField } from "@nexera-ui/react";
export function Values() {
return (
<div className="flex flex-col gap-4">
<CheckboxField label="Email notifications" description="Leave approvals and payslips" />
<CheckboxField
label="Email notifications"
description="Leave approvals and payslips"
defaultSelected
/>
<CheckboxField
label="Email notifications"
description="Leave approvals and payslips"
isIndeterminate
/>
</div>
);
}
Disabled and invalid
Figma State=Disabled (isDisabled) and State=Error (isInvalid with an errorMessage).
import { CheckboxField } from "@nexera-ui/react";
export function DisabledAndInvalid() {
return (
<div className="flex flex-col gap-4">
<CheckboxField
label="Email notifications"
description="Leave approvals and payslips"
isDisabled
/>
<CheckboxField
label="Email notifications"
description="Leave approvals and payslips"
isDisabled
defaultSelected
/>
<CheckboxField
label="I accept the leave policy"
description="Read it before you submit."
isInvalid
errorMessage="Accept the policy to continue."
/>
</div>
);
}
In group
Fields in a CheckboxGroup: the group names them and shows one error for all.
import { CheckboxField, CheckboxGroup } from "@nexera-ui/react";
export function InGroup() {
return (
<CheckboxGroup label="Notify me about" description="Sent to your work email." isRequired>
<CheckboxField value="leave" label="Leave requests" description="When someone applies" />
<CheckboxField value="payslips" label="Payslips" description="On the last working day" />
</CheckboxGroup>
);
}
Long text
Labels and descriptions wrap under themselves; the box stays aligned with the first line.
import { CheckboxField } from "@nexera-ui/react";
export function LongText() {
return (
<CheckboxField
label="Send me an email whenever someone on my team requests leave, including half days"
description="Approvals, cancellations and changes to public holidays in every office you manage"
/>
);
}
Right to left
Right-to-left: the box moves to the start (right) of the row.
import { CheckboxField } from "@nexera-ui/react";
<CheckboxField
label="إشعارات البريد الإلكتروني"
description="الموافقات على الإجازات وقسائم الرواتب"
/>;
Props 29
Press "Try it" on a card to load that prop into the playground.
29 props shown
descriptionNexeraReactNodeHelper text under the label. Linked with
aria-describedby; turns status/danger/fg while invalid. Plain text: it sits inside the
clickable row, so it must not contain links or buttons. Shown when provided.
errorMessageNexeraReactNode | ((validation: ValidationResult) => ReactNode)Error under the row, with an icon. Shown while the field is invalid (isInvalid,
validate, or native isRequired validation on submit); defaults to the validation message. Inside a
CheckboxGroup the group shows the error instead. Write how to fix it.
classNameNexerastringExtra classes for the root, merged last so they win over the defaults.
styleNexeraCSSPropertiesInline style of the root.
labelNexeraVisibleContentVisible label. It is the accessible name (the description is not part of it), wraps and is never truncated. Write a positive statement ("Send me payslip emails"). No visible label.
aria-labelNexerastringOverrides the name given by label. Avoid: the name must contain the visible text (WCAG 2.5.3).
Accessible name. Translate it.
Accessible name; aria-labelledby wins when both are set.
aria-labelledbyNexerastringId(s) of element(s) that name the checkbox instead of label.
Id(s) of element(s) that name the checkbox; wins over aria-label.
Id(s) of visible element(s) that name the checkbox.
validationBehaviorReact Aria"native" | "aria"Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.
isIndeterminateReact AriabooleanIndeterminism is presentational only. The indeterminate visual representation remains regardless of user interaction.
valueReact AriastringThe value of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefvalue).
defaultSelectedReact AriabooleanWhether the element should be selected (uncontrolled).
isSelectedReact AriabooleanWhether the element should be selected (controlled).
onChangeReact Aria(isSelected: boolean) => voidHandler that is called when the element's selection state changes.
isDisabledReact AriabooleanWhether the input is disabled.
isReadOnlyReact AriabooleanWhether the input can be selected but not changed by the user.
isRequiredReact AriabooleanWhether user input is required on the input before form submission.
isInvalidReact AriabooleanWhether the input value is invalid.
validateReact Aria(value: boolean) => true | ValidationError | nullA function that returns an error message if a given value is invalid.
Validation errors are displayed to the user when the form is submitted
if validationBehavior="native". For realtime validation, use the isInvalid
prop instead.
autoFocusReact AriabooleanWhether the element should receive focus on render.
nameReact AriastringThe name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
formReact AriastringThe <form> element to associate the input with.
The value of this attribute must be the id of a <form> in the same document.
See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#form).
idReact AriastringThe element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
aria-describedbyReact AriastringIdentifies the element (or elements) that describes the object.
onPressReact Aria(e: PressEvent) => voidHandler that is called when the press is released over the target.
onPressStartReact Aria(e: PressEvent) => voidHandler that is called when a press interaction starts.
onPressEndReact Aria(e: PressEvent) => voidHandler that is called when a press interaction ends, either over the target or when the pointer leaves the target.
onPressChangeReact Aria(isPressed: boolean) => voidHandler that is called when the press state changes.
onPressUpReact Aria(e: PressEvent) => voidHandler that is called when a press is released over the target, regardless of whether it started on the target or not.
inputRefReact AriaRef<HTMLInputElement | null>A ref for the HTML input element.
* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.
Accessible by default.
Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.
WCAG 2.2 evidence
7 direct · 4 supporting- 1.3.1Info and RelationshipsLevel A · tested directly
- 1.4.1Use of ColorLevel A · tested directly
- 1.4.4Resize TextLevel AA · supporting test
- 1.4.10ReflowLevel AA · supporting test
- 1.4.12Text SpacingLevel AA · supporting test
- 2.1.1KeyboardLevel A · tested directly
- 2.4.7Focus VisibleLevel AA · tested directly
- 2.5.3Label in NameLevel A · tested directly
- 2.5.8Target Size (Minimum)Level AA · supporting test
- 3.3.1Error IdentificationLevel A · tested directly
- 4.1.2Name, Role, ValueLevel A · tested directly
Fits any width.
Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.
Styling hooks
Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.
data-disableddata-focus-visibledata-invaliddata-readonly
<CheckboxField className="data-disabled:opacity-90 shadow-sm" />Used in blocks
- Sign inSign in and account
- Create accountSign in and account
- Session expiredSign in and account
- Setup checklistOnboarding
- Filters drawerLists, tables and records
- Terms and consentForms and data entry
- Task checklistWork and projects
- Short surveyFeedback and surveys
Related components
- CalendarDayOne day of a {@link CalendarMonth } grid, built on React Aria `CalendarCell`: a `gridcell` whose button is named by the full, localised date ("Wednesday, October 14, 2026"), with `aria-selected`, `aria-disabled` and the "today" and range descriptions read by screen readers (WCAG 1.3.1, 4.1.2).
- CalendarMonthA month calendar for picking a date or a date range: header with previous / next buttons and the localised month name, weekday row, and six weeks of `CalendarDay`s.
- CheckboxThe bare 18 px checkbox: one independent yes/no choice applied on submit, or a row selector in a table, list or tree.
- CheckboxCardA large checkbox option with an icon, a title and a description, for a few options that need explanation (notification channels, benefits).
- ColorInputA hex colour field with a swatch and a picker popover.
- ColorPickerPicks a colour.
- ColorTokenCardDocumentation card for one colour token: a 96 px colour sample with an "Aa" text sample, then the name, token path, hex value and contrast note as text.
- ComboboxA text field with a filtered list of options.