Skip to content

GroupedMultiSelect

A multi-select dropdown with grouped options, checkboxes, color swatches, duration badges, and a "Select All" header. Built on top of vue-select with full custom rendering.

Basic Usage

Demo

Selected IDs: []

Pre-selected Values

Pre-selected

Without Duration & Color

Simplified

Props

Props
PropTypeDefaultDescription
modelValue(string | number | object)[][]Array of selected IDs. Use with v-model.
optionsrequiredGroupOption[]Grouped options array. Each group has id/name and an activities or children array.
labelstring'label'Property name to use as display label for options (e.g. 'name' or 'label').
reduce(option) => unknownoption.id ?? option.valueFunction to extract the value emitted from each selected option.
placeholderstring''Placeholder text shown when no items are selected.
disabledbooleanfalseDisables the entire select.
showSelectAllbooleantrueShows a 'Select All' header row with checkbox and count badge.
showDurationbooleantrueShows duration badges (in minutes) next to each child option.
showColorbooleantrueShows color dot swatches next to options with a color property.
useCombinedIdbooleanfalseUses groupId_childId as the unique key to prevent ID conflicts across groups.
selectClassstring'vue-select-standard text-gray-400'CSS class passed to the vue-select root element.

Emits

Emits
EventPayloadDescription
update:modelValueunknown[]Emitted when selection changes. Returns array of reduced values (IDs by default).

Option Interfaces

ts
interface GroupOption {
  id?: string | number
  name: string
  label?: string
  color?: string
  activities?: ActivityOption[]   // or use children[]
  children?: ActivityOption[]
}

interface ActivityOption {
  id?: string | number
  name: string
  label?: string
  color?: string
  duration?: number               // shown as "X min" badge
}

Built with VitePress