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
| Prop | Type | Default | Description |
|---|---|---|---|
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
| Key | Does |
|---|---|
| Space | Toggles it |
Accessibility
- A native checkbox inside its
<label>.indeterminateis announced as "mixed".
Generated from src/components/Checkbox.tsx. Something wrong or missing? Open an issue.