GitHub

Checkbox

Toggle control for boolean selection

Installation

pnpm add @corew500/ui

Usage

import { Checkbox } from "@corew500/ui/checkbox"

<Checkbox>Content</Checkbox>

Variants

checkboxVariants

AxisValuesDefault
size
smdefaultlg
default

checkboxIndicatorVariants

AxisValuesDefault
size
smdefaultlg
default

CMS Integration

CMSPayload CMS Integration
This component supports CMS-driven content via @corew500/cms-payload.
Loading...

API Reference

Props

PropTypeDefaultDescription
sizeenum"default"Size variant for the checkbox.
classNameenumCSS class applied to the element, or a function that returns a class based on the component’s state.
defaultCheckedenumfalseWhether the checkbox is initially ticked. To render a controlled checkbox, use the `checked` prop instead.
styleenumStyle applied to the element, or a function that returns a style object based on the component’s state.
idstringThe id of the input element.
valuestringThe value of the selected checkbox.
renderenumAllows you to replace the component’s HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
namestringundefinedIdentifies the field when a form is submitted.
checkedenumundefinedWhether the checkbox is currently ticked. To render an uncontrolled checkbox, use the `defaultChecked` prop instead.
disabledenumfalseWhether the component should ignore user interaction.
onCheckedChange(checked: boolean, eventDetails: { reason: "none"; event: Event; cancel: () => void; allowPropagation: () => void; isCanceled: boolean; isPropagationAllowed: boolean; trigger: Element; }) => voidEvent handler called when the checkbox is ticked or unticked.
readOnlyenumfalseWhether the user should be unable to tick or untick the checkbox.
requiredenumfalseWhether the user must tick the checkbox before submitting a form.
indeterminateenumfalseWhether the checkbox is in a mixed state: neither ticked, nor unticked.
inputRefenumA ref to access the hidden `<input>` element.
parentenumfalseWhether the checkbox controls a group of child checkboxes. Must be used in a [Checkbox Group](https://base-ui.com/react/components/checkbox-group).
uncheckedValuestringThe value submitted with the form when the checkbox is unchecked. By default, unchecked checkboxes do not submit any value, matching native checkbox behavior.
nativeButtonenumfalseWhether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `true` if the rendered element is a native button.

Accessibility

Keyboard Navigation

  • Supports keyboard activation (Space to toggle)
  • Focus ring visible for keyboard navigation

Screen Readers

  • Checked state announced by screen readers

Additional

  • - Uses native checkbox semantics via Base UI primitive
  • Associate with Label using htmlFor/id for accessible name

Localization

Translatable Content

  • - Checkbox has no text content; localize the associated Label

Related