Basic Components
Checkbox
Allows users to select one or more options from a set. Checkboxes are ideal for binary choices and multiple selections within forms.
Basic usage
Checkbox should be used inside a Label with matching id/htmlFor. Label defaults to a stacked column layout, so add row itemsCenter to place the checkbox inline with its text. The checkbox takes its size from the Label, so match the Label's size to its text (here md) to keep the box centered on the first line of a multi-line label.
<Col> <Label row itemsCenter htmlFor="terms"> <Checkbox id="terms"/> <span>I agree to the <Link href="#">Terms of Service</Link> and <Link href="#">Privacy Policy</Link>.</span> </Label>
<Label md row itemsCenter htmlFor="emails"> <Checkbox defaultChecked id="emails"/> <Col noGap tag="span"> <Text>Receive product updates</Text> <Text xs secondary>Occasional emails about new features</Text> </Col> </Label></Col>Sizes
Checkboxes in different sizes: xs, sm, md (default), lg, xl. A Checkbox nested inside a Label inherits the Label's size automatically. Set it once on the Label and both scale together.
<Row flexWrap> <Label row itemsCenter xs htmlFor="size-xs"> <Checkbox id="size-xs" defaultChecked/> Size: xs </Label> <Label row itemsCenter sm htmlFor="size-sm"> <Checkbox id="size-sm" defaultChecked/> Size: sm </Label> <Label row itemsCenter md htmlFor="size-md"> <Checkbox id="size-md" defaultChecked/> Size: md </Label> <Label row itemsCenter lg htmlFor="size-lg"> <Checkbox id="size-lg" defaultChecked/> Size: lg </Label> <Label row itemsCenter xl htmlFor="size-xl"> <Checkbox id="size-xl" defaultChecked/> Size: xl </Label></Row>Appearances
Different color appearances applied to the Checkbox; always place inside a Label.
<Row flexWrap> <Label row itemsCenter htmlFor="appearance-primary"> <Checkbox id="appearance-primary" defaultChecked/> Enable primary style </Label> <Label row itemsCenter brand htmlFor="appearance-brand"> <Checkbox brand id="appearance-brand" defaultChecked/> Enable brand style </Label> <Label row itemsCenter accent htmlFor="appearance-accent"> <Checkbox accent id="appearance-accent" defaultChecked/> Enable accent style </Label> <Label row itemsCenter secondary htmlFor="appearance-secondary"> <Checkbox secondary id="appearance-secondary" defaultChecked/> Enable secondary style </Label> <Label row itemsCenter tertiary htmlFor="appearance-tertiary"> <Checkbox tertiary id="appearance-tertiary" defaultChecked/> Enable tertiary style </Label> <Label row itemsCenter success htmlFor="appearance-success"> <Checkbox success id="appearance-success" defaultChecked/> Enable success style </Label> <Label row itemsCenter danger htmlFor="appearance-danger"> <Checkbox danger id="appearance-danger" defaultChecked/> Enable danger style </Label> <Label row itemsCenter warning htmlFor="appearance-warning"> <Checkbox warning id="appearance-warning" defaultChecked/> Enable warning style </Label> <Label row itemsCenter info htmlFor="appearance-info"> <Checkbox info id="appearance-info" defaultChecked/> Enable info style </Label> <Label row itemsCenter link htmlFor="appearance-link"> <Checkbox link id="appearance-link" defaultChecked/> Enable link style </Label> <Label row itemsCenter inherit htmlFor="appearance-inherit"> <Checkbox inherit id="appearance-inherit" defaultChecked/> Enable inherit style </Label></Row>Shapes
Checkboxes support border radius styles: rounded (default), pill, and sharp.
<Row flexWrap> <Label row itemsCenter htmlFor="shape-rounded"> <Checkbox id="shape-rounded" defaultChecked/> Rounded (default) </Label> <Label row itemsCenter htmlFor="shape-pill"> <Checkbox pill id="shape-pill" defaultChecked/> Pill </Label> <Label row itemsCenter htmlFor="shape-sharp"> <Checkbox sharp id="shape-sharp" defaultChecked/> Sharp </Label></Row>Disabled
Use the disabled HTML attribute to prevent interaction.
<Col> <Label row itemsCenter htmlFor="disabled-unchecked"> <Checkbox disabled id="disabled-unchecked"/> Disabled (unchecked) </Label> <Label row itemsCenter htmlFor="disabled-checked"> <Checkbox disabled defaultChecked id="disabled-checked"/> Disabled (checked) </Label></Col>Controlled vs uncontrolled
Checkbox forwards every HTML input attribute, so use defaultChecked for uncontrolled state and checked + onChange for controlled state.
Uncontrolled: initial value only, the input manages its own state.
<Label row itemsCenter htmlFor="uncontrolled"> <Checkbox defaultChecked id="uncontrolled"/> Uncontrolled (defaultChecked)</Label>Controlled: parent owns the value via useState.
const [checked, setChecked] = useState(false);
return ( <Label row itemsCenter htmlFor="controlled"> <Checkbox id="controlled" checked={checked} onChange={(e) => setChecked(e.target.checked)} /> Controlled ({checked ? 'on' : 'off'}) </Label>);Indeterminate state
Use the indeterminate prop for "select all" checkboxes that represent a partially selected group. It is visual only: it renders a dash (the box fills like a checked one) and does not change the checked value, so you set it from your own state and manage the real values yourself.
<Label row itemsCenter> <Checkbox indeterminate /> Indeterminate</Label>Wire it to a group so "Select all" reflects and controls the children: checked when all are on, indeterminate when some are on, and clicking it toggles them all.
const [items, setItems] = React.useState([true, true, false, false]);const allChecked = items.every(Boolean);const anyChecked = items.some(Boolean);const labels = ['Item one', 'Item two', 'Item three', 'Item four'];return ( <Col> <Label row itemsCenter> <Checkbox checked={allChecked} indeterminate={anyChecked && !allChecked} onChange={() => setItems(items.map(() => !allChecked))} /> Select all ({items.filter(Boolean).length} of {items.length} selected) </Label> <Col style={{ paddingLeft: 24 }}> {labels.map((label, i) => ( <Label row itemsCenter key={label}> <Checkbox checked={items[i]} onChange={() => setItems(items.map((v, idx) => (idx === i ? !v : v)))} /> {label} </Label> ))} </Col> </Col>);Checkbox group
Multiple labeled checkboxes working together.
<Col> <Label row itemsCenter htmlFor="opt-1"> <Checkbox id="opt-1" defaultChecked/> Email notifications </Label> <Label row itemsCenter htmlFor="opt-2"> <Checkbox id="opt-2"/> SMS alerts </Label> <Label row itemsCenter htmlFor="opt-3"> <Checkbox id="opt-3"/> Push notifications </Label></Col>Customizing
Set app-wide Checkbox defaults with ThemeProvider's themeDefaults and tune the checked-state visuals with extraClasses:
<ThemeProvider themeDefaults={{ checkbox: { input: { lg: true } } }} extraClasses={{ checkbox: { input: { primary: 'checked:bg-brand-600 checked:border-brand-600' } } }}> <Label row itemsCenter htmlFor="terms"> <Checkbox id="terms"/> I agree to the terms </Label></ThemeProvider>Checkbox Props
| Prop | Category | Default | Description |
|---|---|---|---|
accent | Appearance | Accent color appearance (rose) | |
brand | Appearance | Brand color appearance (blue) | |
danger | Appearance | Danger color appearance (red) | |
info | Appearance | Info color appearance (cyan) | |
inherit | Appearance | Inherit appearance from parent — suppresses own data-appearance/data-variant, uses parent's CSS variables | |
link | Appearance | Link color appearance (blue, for hyperlinks) | |
primary | Appearance | ✓ | Primary color appearance (gray) |
secondary | Appearance | Secondary color appearance (gray) | |
success | Appearance | Success color appearance (green) | |
tertiary | Appearance | Tertiary color appearance | |
warning | Appearance | Warning color appearance (amber) | |
disabled | Disabled | Disable the component — reduces opacity, changes cursor to not-allowed, and prevents interaction | |
pill | Shape | Fully rounded corners (circular) | |
rounded | Shape | ✓ | Medium rounded corners (default) |
sharp | Shape | No rounded corners (square) | |
lg | Size | Large size | |
md | Size | ✓ | Medium size (default) |
sm | Size | Small size | |
xl | Size | Extra large size | |
xs | Size | Extra small size | |
error | Status | Show error state (red border/ring) for form validation | |
filled | Variant | ✓ | Filled variant - solid background with contrasting text color |
ghost | Variant | Ghost variant - transparent background, no border, appearance-colored text, tinted hover background | |
outline | Variant | Outline variant - transparent background with border and colored text (default) |
Layout & utility props (gap, padding, hide, items, justify, ...) — documented on Common Props
| Prop | Category | Default | Description |
|---|---|---|---|
selfAuto | Align Self | Use the parent's align-items value (align-self: auto) | |
selfBaseline | Align Self | Align this item to its baseline (align-self: baseline) | |
selfCenter | Align Self | Center this item on the cross axis (align-self: center) | |
selfEnd | Align Self | Align this item to the end of the cross axis (align-self: flex-end) | |
selfStart | Align Self | Align this item to the start of the cross axis (align-self: flex-start) | |
selfStretch | Align Self | Stretch this item to fill the cross axis (align-self: stretch) | |
border | Border | ✓ | Enable border on all sides |
borderB | Border | Enable border on bottom | |
borderE | Border | Enable border on the inline-end side (right in LTR, left in RTL) | |
borderL | Border | Enable border on left | |
borderR | Border | Enable border on right | |
borderS | Border | Enable border on the inline-start side (left in LTR, right in RTL) | |
borderT | Border | Enable border on top | |
borderX | Border | Enable border on left and right | |
borderY | Border | Enable border on top and bottom | |
noBorder | Border | Disable all borders | |
cursorDefault | Cursor | Default cursor - standard arrow | |
cursorMove | Cursor | Move cursor - indicates draggable element | |
cursorNone | Cursor | No cursor - hides the cursor | |
cursorNotAllowed | Cursor | Not-allowed cursor - indicates disabled state | |
cursorPointer | Cursor | ✓ | Pointer cursor - indicates clickable element |
cursorText | Cursor | Text cursor - indicates selectable text | |
cursorWait | Cursor | Wait cursor - indicates loading/processing | |
block | Display | Block display - takes full width, new line | |
contents | Display | Contents display - element's box is removed, children display as if parent didn't exist | |
flex | Display | Flex display - flexbox container | |
grid | Display | Grid display - CSS grid container | |
hidden | Display | Hidden display - element is not visible | |
inline | Display | Inline display - flows with text | |
inlineBlock | Display | Inline-block display - inline but with block properties | |
inlineFlex | Display | Inline-flex display - inline flexbox container | |
inlineGrid | Display | Inline-grid display - inline grid container | |
table | Display | Table display - behaves like table element | |
tableCell | Display | Table-cell display - behaves like td element | |
focusVisible | Focus Visible | ✓ | Enable focus-visible outline |
noFocusVisible | Focus Visible | Disable focus-visible outline | |
hAuto | Height | Set height to auto | |
hFit | Height | Set height to fit-content | |
hFull | Height | Set height to 100% | |
hScreen | Height | Set height to 100vh (viewport height), removes max-height constraint | |
desktopHide | Hide | Hide element on desktop devices and below (max-desktop: 80rem) | |
mobileHide | Hide | Hide element on mobile devices and below (max-mobile: 48rem) | |
tabletHide | Hide | Hide element on tablet devices and below (max-tablet: 64rem) | |
itemsBaseline | Items | Align items to baseline | |
itemsCenter | Items | Align items to center | |
itemsEnd | Items | Align items to end (bottom/right) | |
itemsStart | Items | Align items to start (top/left) | |
itemsStretch | Items | Stretch items to fill container | |
justifyAround | Justify | Distribute items with space around them | |
justifyBaseline | Justify | Align items along their baseline on main axis | |
justifyBetween | Justify | Distribute items with space between them | |
justifyCenter | Justify | Center items along the main axis | |
justifyEnd | Justify | Pack items toward the end of the main axis | |
justifyEvenly | Justify | Distribute items with equal space around them | |
justifyStart | Justify | Pack items toward the start of the main axis | |
justifyStretch | Justify | Stretch items to fill the main axis | |
overflowAuto | Overflow | Auto overflow - show scrollbars if needed | |
overflowClip | Overflow | Clip overflow - hard clip without scrollbars | |
overflowHidden | Overflow | Hidden overflow - clip content without scrollbars | |
overflowScroll | Overflow | Scroll overflow - always show scrollbars | |
overflowVisible | Overflow | Visible overflow - content extends beyond bounds | |
overflowXAuto | Overflow | Auto overflow on X-axis only | |
overflowXClip | Overflow | Clip overflow on X-axis only | |
overflowXHidden | Overflow | Hidden overflow on X-axis only | |
overflowXScroll | Overflow | Scroll overflow on X-axis only | |
overflowXVisible | Overflow | Visible overflow on X-axis only | |
overflowYAuto | Overflow | Auto overflow on Y-axis only | |
overflowYClip | Overflow | Clip overflow on Y-axis only | |
overflowYHidden | Overflow | Hidden overflow on Y-axis only | |
overflowYScroll | Overflow | Scroll overflow on Y-axis only | |
overflowYVisible | Overflow | Visible overflow on Y-axis only | |
absolute | Position | Absolute positioning | |
fixed | Position | Fixed positioning | |
relative | Position | Relative positioning | |
static | Position | Static positioning | |
sticky | Position | Sticky positioning | |
responsive | Responsive | Enable responsive sizing - uses breakpoint-specific classes for font size, padding, and gap | |
noRing | Ring | ✓ | Disable focus ring |
ring | Ring | Enable focus ring | |
noShadow | Shadow | ✓ | Disable drop shadow |
shadow | Shadow | Enable drop shadow | |
noTransition | Transition | Disable transitions for instant state changes | |
transition | Transition | Enable smooth transitions between states | |
transparent | Transparent | Disable background color - makes component background transparent | |
wAuto | Width | Set width to auto | |
wFit | Width | Set width to fit-content | |
wFull | Width | Set width to 100% | |
wScreen | Width | Set width to 100vw (viewport width), removes max-width constraint |