NOCTA UI

Checkbox

A versatile checkbox component for forms and selections with multiple variants, sizes and dark mode support

Installation

Install the Checkbox component using the nocta-ui CLI:

npx nocta-ui add checkbox

Import the component:

import { Checkbox } from '@/components/ui/checkbox';

Examples

Default Checkbox

Sizes

Three size options are available: sm, md, and lg. The default size is md.

Small
Medium
Large

API Reference

PropTypeDefaultDescription
checkedbooleanfalseWhether the checkbox is checked
defaultCheckedbooleanfalseInitial checked state (uncontrolled)
onCheckedChange(checked: boolean) => void-Callback fired when the checkbox state changes
size'sm' | 'md' | 'lg''md'The size of the checkbox
disabledbooleanfalseWhether the checkbox is disabled
classNamestring''Additional CSS classes to apply
idstring-The id attribute for the checkbox input

The Checkbox component also accepts all standard HTML input element props through the ...props spread operator.