Skip to main content
Urbicon UI

Checkbox

Accessible checkboxes with indeterminate state, labels, validation, and form integration.

Playground

Required for signup
Variant Style variant (tailwind-variants)
Size Style variant (tailwind-variants)
Tier
Mint
<Checkbox
  error=""
  helper="Required for signup"
  label="Accept terms"
/>

01 Examples

Task list

Checkboxes inside a realistic task surface — the most common pattern for to-dos, settings, and bulk-selection rows.
Completed yesterday
<div class="border-border-subtle bg-surface-elevated w-full space-y-1 rounded-2xl border p-4">
  <Checkbox checked label="Design system tokens" helper="Completed yesterday" />
  <Checkbox checked label="Component variants" />
  <Checkbox label="Documentation pages" />
  <Checkbox label="Accessibility audit" />
</div>

Helper & error

Helper and error text follow the same form-field contract as Input — error overrides helper when both are set.
We send at most one email per week
<Checkbox label="Newsletter" helper="We send at most one email per week" />
<Checkbox label="Terms" error="You must accept the terms to continue" intent="danger" />

02 Micro-Interactions (Mint)

Mint Presets

Hover or click each checkbox to see the effect — mint targets the box, not the label.
<Checkbox mint="scale" label="Scale on hover" checked />
<Checkbox mint="glow" label="Glow on hover" checked intent="success" />
<Checkbox mint={['scale', 'glow']} label="Combined scale + glow" checked intent="danger" />

03 Customization

Slot Class Overrides

Per-instance slotClasses tweak individual slots without going fully unstyled. The box exposes data-state, so overrides can target only the checked state.
<Checkbox checked label="Rounded checkbox" slotClasses={{ box: 'rounded-full' }} />
<Checkbox
  checked
  label="Larger box"
  slotClasses={{ box: 'w-7 h-7 rounded-md', icon: 'w-5 h-5' }}
/>
<Checkbox
  checked
  label="Brand gradient when checked"
  slotClasses={{
    box: 'data-[state=checked]:border-transparent data-[state=checked]:bg-linear-to-br data-[state=checked]:from-violet-500 data-[state=checked]:to-fuchsia-500'
  }}
/>

Fully Custom (unstyled)

Strip all default styles with unstyled and rebuild from scratch — both instances share one slotClasses object. The box exposes data-state for conditional styling.
{@const terminal = {
  control:
    'inline-flex cursor-pointer items-center gap-3 font-mono text-sm text-text-primary',
  box: 'flex h-5 w-5 items-center justify-center rounded border-2 border-current transition-colors data-[state=checked]:bg-text-primary data-[state=checked]:text-surface-base',
  icon: 'h-3.5 w-3.5',
  label: 'select-none'
}}
<Checkbox unstyled checked label="Remember me" slotClasses={terminal} />
<Checkbox unstyled label="Stay signed in" slotClasses={terminal} />

The shared terminal object above is a preset in spirit — for app-wide reuse, register it under presets.Checkbox on BlocksProvider and apply it with preset instead of importing a class map everywhere. See Customization.

04 Accessibility

Native Semantics

Built on a native <input type="checkbox"> for correct form behavior and assistive technology support. The indeterminate property automatically conveys the mixed state, and aria-checked="mixed" is set explicitly for maximum screen reader compatibility.

Labels & Descriptions

The label prop creates an associated <label>. Helper and error text are linked via aria-describedby, and errors set aria-invalid.

Keyboard

Tab to focus, Space to toggle. The focus ring uses focus-visible: for keyboard-only visibility and appears on the checkbox box via the peer pattern.

Color Contrast

Error and helper messages use text alongside color to convey state. The checkbox icon (check / minus) meets WCAG AA contrast against all intent backgrounds.

05 API Reference

22 props
22 props
Prop
Type
Default
Description

06 Types

Local type definitions used by this component.

8 types
Name
Kind
Category
Used by
Description

07 Installation

Import

import { Checkbox } from '@urbicon-ui/blocks';