UI.MD

Checkbox

A control that toggles between checked and unchecked states.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/checkbox.json

Usage

import { Checkbox } from "@/components/ui/checkbox"

Examples

Default

Sizes

With description

API Reference

PropTypeDefaultDescription
size"sm" | "default" | "lg""default"The checkbox size: sm (14px), default (16px), or lg (20px). The check icon scales to match.
checkedboolean | "indeterminate"-The controlled checked state. Use with onCheckedChange.
defaultCheckedboolean-The initial checked state when uncontrolled.
onCheckedChange(checked: boolean | "indeterminate") => void-Called when the checked state changes.
disabledbooleanfalseDisables the checkbox and dims it to 70% opacity.