Select

Select component based on Headless UI Listbox. Support multiple selection.

Usage

Use <Select /> component to create select input.

View Code
<script setup lang="ts">const items = ref([  { value: 1, text: "Wade Cooper" },  { value: 2, text: "Arlene Mccoy" },  { value: 3, text: "Devon Webb" },  { value: 4, text: "Tom Cook" },  { value: 5, text: "Tanya Fox" },  { value: 6, text: "Hellen Schmidt" },]);const selected = ref();</script><template>  <Select    v-model="selected"    placeholder="Choose..."    :items="items"  /></template>

Multiple

Use multiple prop to enable multiple selection to the select component.

View Code
<script setup lang="ts">const items = ref([  { value: 1, text: "Wade Cooper" },  { value: 2, text: "Arlene Mccoy" },  { value: 3, text: "Devon Webb" },  { value: 4, text: "Tom Cook" },  { value: 5, text: "Tanya Fox" },  { value: 6, text: "Hellen Schmidt" },]);const selected = ref();</script><template>  <Select    v-model="selected"    placeholder="Choose..."    :items="items"    multiple  /></template>

Props

PropertyTypeRequiredDefaultDescription
modelValueSelectItemYes-The selected item in the dropdown list.
itemsSelectItem[]Yes[]An array of SelectItem objects to display in the dropdown list.
placeholderstringNo'Choose'The placeholder text to display when no item is selected.
hideCheckIconbooleanNofalseSpecifies whether to hide the check icon when an item is selected.
outlinedbooleanNofalseSpecifies whether the dropdown list should be displayed with an outlined border.
largebooleanNofalseSpecifies whether the dropdown list should be displayed with a large size.
smallbooleanNofalseSpecifies whether the dropdown list should be displayed with a small size.

Events

NamePayloadDescription
update:modelValue{value: SelectItem}Triggered when modelValue prop changed

Types

export type SelectItem = {  text: string;  value: string | number;  divider?: boolean;};