Select UI framework
Get Started
Radix UI
AlertApp Store ButtonAspect RatioBadgeBannerBreadcrumbButton GroupButtonCheckboxCommand MenuCompactButtonDialogDrawerDropdown MenuEmptyFancy ButtonFile UploadHintInput OTPInputItemKbdLabelLinkButtonLoaderPopoverProgress BarProgress CircleRadio GroupRatingSelectSeparatorSkeletonSliderSocial ButtonSwitchTagTextareaToggle GroupToggleTooltip
Component checkbox-demo not found in registry.
Installation
pnpm dlx shadcn@latest add checkbox
Usage
import * as Checkbox from "@/components/ui/checkbox"
export default function CheckboxDemo() {
return (
<div className="flex items-center space-x-2">
<Checkbox.Root id="terms" />
<label htmlFor="terms" className="text-sm font-medium">
Accept terms and conditions
</label>
</div>
)
}Examples
States
Component checkbox-states not found in registry.
With Text
Component checkbox-with-text not found in registry.
Controlled
Component checkbox-controlled not found in registry.
Props
Checkbox
This component is based on the Radix UI Checkbox primitive and supports all of its props.
Prop
Type
Default
checked
boolean'indeterminate'-
defaultChecked
boolean-
onCheckedChange
(checked: boolean | 'indeterminate') => void-
disabled
boolean-
required
boolean-
name
string-
value
string-
className
string-