1. Documentation
  2. Forms
  3. Checkbox
ReadmenpmGitHub
  • Introduction
  • Installation
  • Theming
  • Icons
  • Accordion
  • Card
  • Scroll Area
  • Separator
  • Sidebar
  • Field
  • Label
  • Input
  • Textarea
  • Number Field
  • OTP Field
  • Select
  • Combobox
  • Checkbox
  • Radio
  • Switch
  • Slider
  • Toggle
  • Calendar
  • Date Picker
  • File Upload
  • Button
  • Copy Button
  • Dropdown
  • Command
  • Tabs
  • Breadcrumb
  • Pagination
  • Tree
  • Table
  • Data Table
  • Stat
  • Timeline
  • Avatar
  • Status Bar
  • Badge
  • Meter
  • Empty
  • Skeleton
  • Spinner
  • Toast
  • Dialog
  • Sheet
  • Popover
  • Tooltip
  • Text
  • Kbd
  • Code Block
  • Utilities
  • Design rules

Checkbox

A checkbox that renders either the whole clickable row or just the box.

Loading documentation…

Combobox< PreviousRadioNext >

Powered by heyo

On this page

UsageIndeterminateA bare boxProperties
<CheckboxdefaultCheckedlabel="Send deploy notifications"description="One email per production deploy."/>

Pass label and Checkbox renders the whole clickable row — box, label, description, and the <label> wrapping that makes all of it a hit target. Without one it renders just the box, for a table's select column or a custom layout; give it an aria-label in that case.

Usage

tsx
import { Checkbox } from "@heyo-sh/heyo-ui";<Checkbox label="Send deploy notifications" defaultChecked />;

Indeterminate

The third state exists for one reason: a header checkbox above rows where only some are selected. useSelection computes it for you.

<Checkbox indeterminate label="Select all" /><Checkbox defaultChecked label="acme-api" /><Checkbox label="acme-web" />

A bare box

<Checkbox aria-label="Select row" /><Checkbox defaultChecked aria-label="Select row" /><Checkbox disabled aria-label="Select row" /><Checkbox disabled defaultChecked aria-label="Select row" />
Checkbox or Switch?

A checkbox is a value you are editing and will submit — it belongs in a form. A Switch applies immediately, which is why it belongs in settings.

Properties

labelReactNodeoptional

An inline label next to the box. Its presence turns the component into the whole clickable row.

descriptionReactNodeoptional

Muted helper text under the label.

checked / defaultCheckedbooleanoptional

Controlled and uncontrolled state.

onCheckedChange(checked: boolean) => voidoptional

Fires when the box is toggled.

indeterminatebooleanoptional

The mixed state, for a header checkbox above a partial selection.

disabledbooleanoptional

Dims the row and ignores interaction.

wrapperClassNamestringoptional

Class for the outer <label>, used when a label or description is given.

classNamestringoptional

Class for the box itself.

name / required / value—optional

Standard form behaviour, passed through to Base UI.