Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Core

Checkbox

Native checkbox with a label and hint. indeterminate shows a dash for a partly checked group.

import { Checkbox } from "@stylhero/ui";

Example

Code
import { Checkbox, Stack } from "@stylhero/ui";

function CheckboxExample() {
  return (
    <Stack gap={2}>
      <Checkbox label="Email me about price drops" defaultChecked />
      <Checkbox label="Some parts selected" indeterminate />
      <Checkbox label="Unavailable" disabled />
    </Stack>
  );
}

Props

PropTypeDefaultDescription
label required ReactNode -
hint ReactNode - Smaller text under the label.
indeterminate boolean - Shows a dash: some, but not all, children are checked (e.g. "select all").

Also takes every <input> attribute (id, style, data-*, aria-*, event handlers…), passed to that element. Takes a ref.

Keyboard

KeyDoes
SpaceToggles it

Accessibility

  • A native checkbox inside its <label>. indeterminate is announced as "mixed".

Generated from src/components/Checkbox.tsx. Something wrong or missing? Open an issue.