Selection
A headless component for managing selection state in collections with support for single and multi-selection patterns.
Usage
The Selection component provides a wrapper and item pattern for managing selection state in collections. It supports both single and multi-selection with full v-model support and automatic state synchronization.
Selected:
Anatomy
<script setup lang="ts">
import { Selection } from '@vuetify/v0'
</script>
<template>
<Selection.Root>
<Selection.Item />
</Selection.Root>
</template>Accessibility
Selection is a headless state provider, not a complete listbox. Item attrs include role="option", a tabindex, Enter/Space, and the click handler.
Selection.Rootexposesaria-multiselectable, reflecting themultipleprop —truein multi-select mode,falseotherwise.Selection.Itemexposesaria-selectedandaria-disabled, plusdata-selectedanddata-disabledfor styling.
Binding attrs already supplies role="option" and Enter/Space. Add arrow-key roving yourself if the pattern needs it. For a finished widget, use Radio or Checkbox, which add native inputs and label association.
FAQ
The component wraps createSelection internally, exposing the same logic through a compound Selection.Root / Selection.Item template API. Reach for the composable directly when you need state without the component surface.
Bind v-model on Selection.Root — it provides full v-model support with automatic synchronization between the model and the selected items.