Checkbox
A headless checkbox component that provides accessible, flexible checkbox functionality. Supports standalone boolean state or multi-selection within groups, with full keyboard navigation and form integration.Features
- Dual-mode operation: Standalone with v-model or group multi-selection
- Tri-state support: Checked, unchecked, and indeterminate states
- Full accessibility: ARIA attributes, keyboard navigation, screen reader support
- Form integration: Automatic hidden input generation for native form submission
- Select all: Built-in component for bulk selection in groups
- Flexible rendering: Works with any element via
asprop or renderless mode
Basic Usage
Standalone Checkbox
Checkbox Group
Components
Checkbox.Root
The main checkbox component. Supports standalone mode with v-model or group mode withinCheckbox.Group.
The checked state (standalone mode only)
Value associated with this checkbox (used in group mode and form submission)
Form field name. When provided, automatically renders a hidden input for form submission
Disables the checkbox, preventing interaction
Sets the indeterminate/mixed state (standalone mode)
Optional display label (passed to slot props)
Unique identifier (auto-generated if not provided)
Associate with a form element by ID
HTML element to render as
Render only slot content without wrapper element
Context namespace for child components
Namespace for connecting to parent group
Slot Props
Whether the checkbox is checked
Whether the checkbox is in indeterminate state
Whether the checkbox is disabled
Function to check the checkbox
Function to uncheck the checkbox
Function to toggle checkbox state
Pre-computed ARIA and data attributes to bind to the element
Checkbox.Group
Container for managing multiple checkboxes with multi-selection support.Array of selected values
Disables all checkboxes in the group
Auto-select all non-disabled items on mount
false: No enforcementtrue: Prevents deselecting the last item'force': Auto-selects first non-disabled item
Accessible name for the group
HTML element to render as
Render only slot content without wrapper
Context namespace for child checkboxes
Slot Props
Whether the group is disabled
Whether no items are selected
Whether all selectable items are selected
Whether some but not all items are selected
Select all non-disabled items
Unselect all items
Toggle between all selected and none selected
Checkbox.Indicator
Visual indicator that displays when the checkbox is checked or indeterminate.HTML element to render as
Render only slot content without wrapper
Context namespace to inject from parent
Slot Props
Whether the checkbox is checked
Whether the checkbox is indeterminate
Contains
data-state and visibility styleThe indicator is automatically hidden via
visibility: hidden when the checkbox is unchecked and not indeterminate.Checkbox.SelectAll
Special checkbox for selecting/deselecting all items in a group. Must be used withinCheckbox.Group.
Accessible label for the select all checkbox
Disables the select all checkbox
HTML element to render as
Render only slot content without wrapper
Context namespace for child indicator
Namespace for connecting to parent group
Slot Props
Whether all items are selected
Whether some but not all items are selected
Whether the select all is disabled
Select all items
Toggle all items
The SelectAll component does NOT register itself as a group item. It only controls the group’s aggregate state.
Checkbox.HiddenInput
Hidden input for native form submission. Automatically rendered whenname prop is provided to Checkbox.Root.
Form field name (required)
Value to submit when checked (overrides context value)
Associate with form by ID (overrides context form)
Context namespace to inject from parent
Advanced Examples
Indeterminate State
Renderless Mode
Form Integration
Accessibility
- Uses
role="checkbox"andaria-checkedfor proper screen reader support - Supports keyboard navigation (Space to toggle)
- Manages
tabindexfor proper focus management - Provides
aria-disabledwhen disabled - Group uses
role="group"with optionalaria-label - Roving tabindex not used (each checkbox is independently tabbable)