Skip to contentKino
Skip to Content

Checkbox

A checkbox whose tick wipes in along its stroke. In a group, a parent that selects all ticks its boxes one after another.

npx shadcn add https://kinoui.com/r/checkbox.json
Share on

Examples

Default

Wrap it in a <label> with its text. The tick wipes in from the start of its stroke, and wipes back out when cleared.

Email me about

Ledger web app · 12 members

Parent

In a CheckboxGroup with allValues, a checkbox with parent selects all. It shows a dash while only some are picked, and the boxes it changes tick one after another.

Issues

Ledger web app · Cycle 14
2 selected

Table rows

Each row is a <label>, so a press anywhere on it picks the row. Name a box that has no text with aria-label.

Connect Salesforce

Sync accounts and opportunities into Ledger every 15 minutes.

Accept the agreement to connect.

Invalid

Set aria-invalid once the person tries to go on without it, and point aria-describedby at the reason.

Sign-in

Set by your admin for everyone at Ledger.

Disabled

A disabled box fades and can’t be pressed. Say why beside it, as here, so nobody wonders.

Installation

npx shadcn@latest add https://kinoui.com/r/checkbox.json
Files
lib/reduce-motion.tslib/resize.tslib/choice.tscomponents/kino/checkbox.tsx
Packages
@base-ui/react

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

Checkbox

PropTypeDefaultDescription
checkedbooleanNoneWhether it is ticked, when you hold the state.
defaultCheckedbooleanfalseWhether it starts ticked, when it holds its own state.
onCheckedChange(checked, details) => voidNoneCalled when it is ticked or cleared.
indeterminatebooleanfalseShows a dash in place of the tick, for "some of these". A parent sets it for you.
valuestringNoneIts value in a CheckboxGroup.
parentbooleanfalseIn a group with allValues, makes it the box that selects all: it shows a dash while only some are picked.
aria-invalidbooleanNoneDraws it in the destructive colour, with a ring.

CheckboxGroup

PropTypeDefaultDescription
valuestring[]NoneThe values that are ticked, when you hold the state.
defaultValuestring[]NoneThe values that start ticked, when it holds its own state.
onValueChange(value, details) => voidNoneCalled with the new values when a box changes.
allValuesstring[]NoneEvery value in the group, for a parent box to select all.

Data attributes

AttributeOnDescription
data-checkedCheckboxPresent while it is ticked.
data-indeterminateCheckboxPresent while it shows the dash.
data-disabledCheckboxPresent while it is disabled. Style its label with has-data-disabled:.

Accessibility

  • It is a native-feeling checkbox: Space ticks it, and a press on its <label> does too.
  • A box with no text beside it needs aria-label, such as "Select LED-482".
  • The parent is announced as mixed while only some are picked.
  • Ticked, cleared and some each have their own mark, so state never relies on colour. In forced colours the box fills with the system highlight.
  • When the system asks for less motion, the tick appears at once and a group ticks every box together.