Skip to main content
Tw Twintrinsic
  • Getting Started
  • Components
  • Theming
  • Completion
Examples
Data Dashboard Game Map
Core
App
Layout
Accordion AccordionItem Card Container Panel Separator Sidebar Splitter
Navigation
AppHeader BottomBar Breadcrumb BreadcrumbItem Menu MenuItem Tabs Tab TabList TabPanel TreeMenu
Data Display
Avatar AvatarGroup Badge Carousel CarouselItem Chip ChipGroup CodeBlock CodeBlockSpeed CodeEditor DataTable Map Progress Skeleton Table TableBody TableCell TableHead TableHeader TableRow Tag TagGroup Timeline TimelineItem Tooltip Tree TreeNode
Metrics
DonutChart PieChart LineChart BarChart HorizontalBarChart AreaChart StatsCard MetricGrid KPICard GaugeChart ProgressMetric MetricTrend
Form
AutoComplete Button ButtonGroup Calendar Checkbox ColorPicker Combobox Dropdown FileUpload FloatLabel Form FormField Input InputSwitch InvalidState Knob ListInput Listbox NumberInput Radio RadioGroup Rating Select SelectGroup Slider Switch TextInput Textarea
Feedback
Modal Stepper StepperStep Toast
Utility
Icon Lazy LazyPanel Masonry ThemeToggle

Checkbox

The Checkbox component is a form control for boolean or indeterminate input with support for labels, descriptions, validation states, and full accessibility features.

Examples

Basic Usage

<Checkbox label="Accept terms and conditions" />

With Description

Receive updates about new features and announcements
<Checkbox
  label="Subscribe to newsletter"
  description="Receive updates about new features and announcements"
/>

Indeterminate State

Some items are selected
<Checkbox
  label="Select all items"
  indeterminate={true}
  description="Some items are selected"
/>

Required Field

<Checkbox
  label="I agree to the terms"
  required={true}
/>

With Error

You must accept the privacy policy
<Checkbox
  label="Accept privacy policy"
  error="You must accept the privacy policy"
  required={true}
/>

Disabled States

This option is currently unavailable
This task has been completed
<Checkbox
  label="Unavailable option"
  disabled={true}
  description="This option is currently unavailable"
/>
<Checkbox
  label="Completed task"
  disabled={true}
  checked={true}
  description="This task has been completed"
/>

Checkbox Group

<div class="flex flex-col gap-2">
  <Checkbox
    label="Email notifications"
    name="notifications"
    value="email"
  />
  <Checkbox
    label="SMS notifications"
    name="notifications"
    value="sms"
  />
  <Checkbox
    label="Push notifications"
    name="notifications"
    value="push"
  />
</div>

Props

PropTypeDefaultDescription
labelstringRequiredLabel text for the checkbox
descriptionstring""Additional descriptive text
checkedbooleanfalseWhether the checkbox is checked
indeterminatebooleanfalseWhether the checkbox is in an indeterminate state
disabledbooleanfalseWhether the checkbox is disabled
requiredbooleanfalseWhether the checkbox is required
errorstring""Error message to display
namestring""Name attribute for the input
valuestring""Value attribute for the input
classstring""Additional CSS classes

Events

EventDetail TypeDescription
onchange{ checked: boolean }Fired when the checkbox state changes

Accessibility

The Checkbox component follows WAI-ARIA guidelines for checkboxes:

  • Uses native <input type="checkbox"> for best compatibility
  • Labels are properly associated with inputs
  • Required fields are marked with both visual and ARIA indicators
  • Error messages are linked using aria-describedby
  • Invalid states are indicated with aria-invalid
  • Proper focus management and keyboard interaction
  • Support for indeterminate state

Keyboard Interaction

  • Space - Toggle checkbox state
  • Tab - Move focus to checkbox