Checkbox Group
Select any combination of independent options in one labeled group.
Usage
Release channels
Choose one or more independent release channels.
Choose one or more independent release channels.
<!-- Checkbox Group / Release Channels -->
<script setup lang="ts">
import { CheckboxGroupRoot, CheckboxGroupItem, CheckboxGroupIndicator } from '@sectile/vue/checkbox-group'
const items = [
{ value: 'core', label: 'Core' },
{ value: 'dom', label: 'DOM' },
{ value: 'vue', label: 'Vue' },
]
</script>
<template>
<CheckboxGroupRoot :items="items.map(item => item.value)" :default-value="['dom']" name="packages">
<CheckboxGroupItem v-for="item in items" :key="item.value" :value="item.value">
<CheckboxGroupIndicator>✓</CheckboxGroupIndicator>
{{ item.label }}
</CheckboxGroupItem>
</CheckboxGroupRoot>
</template>Disabled choice
Keep one choice visible but unavailable while other choices remain interactive.
Keep one choice visible but unavailable while other choices remain interactive.
<!-- Checkbox Group / Disabled Choice -->
<script setup lang="ts">
import { CheckboxGroupRoot, CheckboxGroupItem, CheckboxGroupIndicator } from '@sectile/vue/checkbox-group'
const items = [
{ value: 'core', label: 'Core' },
{ value: 'dom', label: 'DOM' },
{ value: 'vue', label: 'Vue' },
]
</script>
<template>
<CheckboxGroupRoot :items="items.map(item => item.value)" :default-value="['dom']" name="packages">
<CheckboxGroupItem v-for="item in items" :key="item.value" :value="item.value">
<CheckboxGroupIndicator>✓</CheckboxGroupIndicator>
{{ item.label }}
</CheckboxGroupItem>
</CheckboxGroupRoot>
</template>Controlled
Let the parent own the current value and apply accepted changes back to the component.
Let the parent own the current value and apply accepted changes back to the component.
<!-- Checkbox Group / Controlled -->
<script setup lang="ts">
import { CheckboxGroupRoot, CheckboxGroupItem, CheckboxGroupIndicator } from '@sectile/vue/checkbox-group'
const items = [
{ value: 'core', label: 'Core' },
{ value: 'dom', label: 'DOM' },
{ value: 'vue', label: 'Vue' },
]
</script>
<template>
<CheckboxGroupRoot :items="items.map(item => item.value)" :default-value="['dom']" name="packages">
<CheckboxGroupItem v-for="item in items" :key="item.value" :value="item.value">
<CheckboxGroupIndicator>✓</CheckboxGroupIndicator>
{{ item.label }}
</CheckboxGroupItem>
</CheckboxGroupRoot>
</template>API
Vue package: @sectile/vue/checkbox-group
CheckboxGroupRootCheckboxGroupItemCheckboxGroupIndicator
Props
CheckboxGroupRootProps
asElement or component rendered for this part.
asChildWhether to merge this part into its single child instead of rendering a wrapper.
defaultValueInitial value used when the component owns its state.
disabledWhether interaction is unavailable.
formID of the native form associated with the control.
itemsOrdered item values managed by the component.
labelAccessible name announced for the control.
modelValueCurrent value when state is controlled by the parent.
nameName used for native form submission.
readonlyWhether the value can be inspected but not changed.
requiredWhether the control must contain a valid value before submission.
CheckboxGroupItemProps
asElement or component rendered for this part.
asChildWhether to merge this part into its single child instead of rendering a wrapper.
disabledWhether interaction is unavailable.
requiredWhether the control must contain a valid value before submission.
valueCurrent value exposed by this contract.
Slots
CheckboxGroupRootSlotProps
disabledWhether interaction is unavailable.
readonlyWhether the value can be inspected but not changed.
valueCurrent value exposed by this contract.
Events
CheckboxGroupRoot
update:modelValueEmitted when the component requests a new controlled value.
Other types
CheckboxGroupValueChangeHandler
type CheckboxGroupValueChangeHandler = (value: readonly string[]) => voidParts
Shared scope: [data-scope="checkbox-group"]. Combine it with a part selector to keep styles local to this component.
| Part | Selector | Role | Extra attributes |
|---|---|---|---|
root | [data-part="root"] | Defines the component boundary and owns its composed parts. | — |
item | [data-part="item"] | Represents one selectable or actionable item. | — |
indicator | [data-part="indicator"] | Shows state or position without replacing the primary content. | — |
Keyboard interaction
| Key | Behavior |
|---|---|
| Tab | Move focus into and out of the group. |
| Space | Toggle the focused checkbox item. |
Accessibility
The labeled group preserves each item as an independently focusable checkbox with checked and disabled state.
See the corresponding WAI-ARIA pattern for the host accessibility contract.
