Checkbox
Accessible checkbox with label, description, indeterminate state, and three size options
Quick Preview
Structure
Anatomy of the Checkbox โ a check control with optional label and description.
States
Click any checkbox to toggle it live.
Checkbox โ all states
Click the interactive cells to toggle live
Unchecked
Default โ not selected
Checked
Selected
Indeterminate
Partial selection
Disabled โ off
Cannot interact
Disabled โ on
Locked in checked
With description
Label + helper text
Sizes
Three size tokens โ sm md (default) lg.
Sizes โ sm / md / lg
Click to toggle each size
Small โ sm
Compact, inline use
Medium โ md
Default size
Large โ lg
Touch-friendly
Installation
// Copy the Checkbox component fromsrc/components/forms/Checkbox.tsx
Usage
'use client'import { useState } from 'react'import { Checkbox } from '@/components/forms/Checkbox'export default function Example() {const [checked, setChecked] = useState(false)return (<Checkboxid="tos"checked={checked}onCheckedChange={setChecked}label="I agree to the terms of service"/>)}
Examples
With Description
Indeterminate (Select All)
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | false | Controlled checked state |
onCheckedChange | (checked: boolean) => void | - | Change handler |
indeterminate | boolean | false | Show indeterminate (mixed) state |
label | string | - | Label text shown beside the checkbox |
description | string | - | Helper text shown below the label |
disabled | boolean | false | Disable the checkbox |
size | "sm" | "md" | "lg" | "md" | Checkbox and label size |
id | string | - | HTML id for label association |
Features
- โThree sizes: sm, md, lg
- โIndeterminate state support
- โAccessible label and description
- โFocus ring for keyboard navigation
- โDisabled state
- โforwardRef support
- โClient Component