Skip to content

Checkbox

A boolean checkbox. Supports an indeterminate state, a description (ts checkbox-description), card mode (is-card), an error (is-invalid), and grouping with ts checkbox-group, which includes “select all” (data-ts-select-all).

Forms · TaishoDS Core, in plain HTML.

Examples

One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.

Checked

html

Unchecked

html

“Select all” with partial selection

html

Disabled

html

With description

html

Environment cards: checked

html

Environment cards: unchecked

html

With error

html

With hint

html

Notification group with error

Notifications
html

Class reference

Every value of each modifier, with its HTML ready to copy.

Size

Checkbox size: sm, md, or lg.

html

Variant

The color when checked. primary by default, which takes the theme primary (primary; the brand if you don’t set one), or a status color (success, danger…).

html

Density

The spacing around the checkbox and its label.

html

States

The checkbox states: is-checked, is-indeterminate, and is-disabled.

html

Combinations

Size and color combined.

html

When to use

  • A yes/no option that’s confirmed when the form is submitted (terms, a flag).
  • Choosing several items from a list, inside a ts checkbox-group.
  • You need the indeterminate state (a partial “select all”).
  • You need to show an error or hint right next to the checkbox, on its own or inside the field markup.

When not to use

  • The change applies immediately, not on submit → toggle.
  • It’s choosing one of several → radio.

Do

  • Write a clear, positive label, so checking it means what it says.
  • Group several related checkboxes with ts checkbox-group.
  • If the label alone isn’t enough to decide, add a description (has-description). The is-card mode works when each option is a card (a plan, a channel).
  • A group error (Choose at least one channel.) goes once on the group, not repeated on every checkbox.

Don’t

  • Don’t use it for a setting that takes effect immediately → toggle.
  • Don’t build a group where only one can be checked → radio.
  • Don’t use is-card for a standalone accept-the-terms checkbox. Cards are for choosing between options.

TaishoDS Core

Needs Core’s JS, which hooks in through data-ts-* attributes.

It’s a native <input type="checkbox">. The browser handles focus, keyboard, and form submission. To paint the state, Core mirrors checked to the label’s is-checked class. The error, hint, and description are markup the example already includes.

What it does: A group (ts checkbox-group) with a “select all” checkbox (data-ts-select-all on the parent checkbox). It checks or unchecks all the others, and turns mixed (indeterminate) when only some are checked.

From the CDN, without a build, load taisho.checkbox.css along with taisho.base.css. Also load:

  • taisho.icon.css

For how Core works in general, see Behavior.

Accessibility

Implements the Checkbox pattern from the WAI-ARIA APG.

  • It’s built on a native <input type="checkbox"> (focus, keyboard, and accessible states out of the box).
  • The mixed (indeterminate) state is reflected in the <input>'s real DOM property, not just visually.
  • A checkbox group goes in a role="group" container with an accessible name (aria-label, or aria-labelledby pointing to the group’s visible text).
  • The hint text and the error message are linked to the <input> through aria-describedby. The invalid state sets aria-invalid="true", and the error is announced (aria-live="polite"). In a group, each checkbox carries the invalid state (role="group" doesn’t support aria-invalid), and the message describes the group.
  • The checkbox’s description stays inside the <label>, so it’s part of its accessible name.

Verification

What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.

  • axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
  • keyboard Adds no keys of its own—it uses the browser’s native behavior.
  • screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.