Skip to content

Checkbox

Stable

A tick box with a visible label and hint. It can show a partly selected state.

Also known as check box, tick box

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

Controlled checkbox

Your code keeps the checked value and updates it when the box changes.

When to use it

Lets a person tick or untick one option. It is for choices that take effect when a form is sent, and for picking several items at once.

Made of: Box · Check or dash · Label · Hint

Use it for

  • A choice in a form, such as agreeing to terms.
  • Picking several items from a list.
  • A select-all box above a list, using the partly selected state.

Not for

  • A setting that applies the moment it is flipped: use Switch.
  • Exactly one choice from a few options: use RadioGroup.
  • One choice from a long list: use Select.

Do and avoid

Do. Each box stands alone, so people can tick any of them.
Avoid. Boxes for an either-or choice let people pick both by mistake.

Do

  • Write the label so it is true when the box is ticked, such as "Share this chat".
  • Use the partly selected state only for a box that controls a list of other boxes.
  • Keep the checked value in your own code and pass it back as checked.
  • Say why a box is disabled in text nearby.

Avoid

  • Do not use a Checkbox for a setting that applies at once. Use a Switch.
  • Do not use one for a choice between exclusive options. Use a RadioGroup.
  • Do not leave out both the label and ariaLabel.
  • Do not show an error with the red border alone.

On a phone

  • The whole row is the tap target and is at least 44px tall on touch screens, while the box stays 20px.
  • The label and description wrap inside the row instead of running off the screen.
  • Nothing depends on hover.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started