Skip to content

GroupSelect

A select dropdown that renders grouped options with clear section headers. Built on vue-select with custom group rendering.

Usage

vue
<script setup>
import { ref } from 'vue'
import { GroupSelect } from 'praxis-vue-ui'

const groups = [
  { name: 'Physicians', children: [{ id: 1, name: 'Dr. Alice' }, { id: 2, name: 'Dr. Bob' }] },
  { name: 'Nurses', children: [{ id: 3, name: 'Carol RN' }, { id: 4, name: 'David RN' }] },
]
const selected = ref(null)
</script>

<template>
  <GroupSelect
    v-model="selected"
    :options="groups"
    label="Provider"
    placeholder="Select a provider..."
  />
</template>

Props

PropTypeDefaultDescription
modelValueunknownnullSelected value. Use with v-model.
optionsrequiredGroupOption[]Grouped options. Each group has a name and children array.
labelstringundefinedField label text.
placeholderstring''Dropdown placeholder.
disabledbooleanfalseDisables the select.
reduce(option) => unknownoption => option.idValue extractor function.

Emits

EventPayloadDescription
update:modelValueunknownEmitted on selection change.

Built with VitePress