Skip to content

Select

Choose one or more values from a dropdown.

Demos

Size
Variant

Usage

vue
<script setup lang="ts">
import { Accordion } from '~/components/ui/accordion'

const items = [
  { value: 'source', label: 'Do I own the source?', content: 'Yes. Copy and adapt the files.' },
]
</script>

<template>
  <Accordion :items="items" />
</template>

Installation

Complete the shared installation. Copy Select.vue and index.ts into app/components/ui/select/.

API

Variants and defaults

PropValuesDefault
sizexs, sm, md, lg, xlsm
variantoutline, soft, bareoutline

Props

PropTypeDefaultDescription
optionsSelectOption[]requiredOptions rendered in the listbox.
valueKeystring—Object key used as option value. Falls back to value, then label.
labelKeystring"label"Object key used as option label.
descriptionKeystring"description"Object key used as option description.
disabledKeystring"disabled"Object key used as option disabled state.
placeholderstring"Select option"Text shown when no value is selected.
multiplebooleanfalseEnables multi-select. v-model should be string[].
nullableValuestring""Native empty option value for single select.
idstringfield idTrigger id.
namestringfield nameForm field name. Renders a hidden native select.
requiredbooleanfalseRequired state.
disabledbooleanfalseDisables trigger and options.
invalidbooleanfalseSets invalid attrs.
loopbooleantrueArrow navigation wraps.
autocompletebooleanfalseRenders a search input in the popup and filters visible options.
filter(option, search) => booleanlabel/description contains searchCustom autocomplete filter.
loadingbooleanfalseShows loading slot/content inside the popup.
emptyLabelstring"No options found."Default empty state text.
searchPlaceholderstring"Search options..."Search input placeholder.
resetSearchOnSelectbooleanfalseClears search after selection.
highlightOnHoverbooleantruePointer hover updates highlighted option.
side"top" | "right" | "bottom" | "left""bottom"Popup side.
align"start" | "center" | "end""start"Popup alignment.
sideOffsetnumber6Popup offset in px.
ariaLabelstring—Accessible label when no visible label exists.
ariaLabelledbystring—Accessible label id.
ariaDescribedbystringfield description/errorAccessible description ids.
uiSelectUi—Classes for structural parts.

Slots

SlotPropsDescription
triggerisOpen, selectedOption, selectedOptions, selectedValue, selectedValues, selectedLabel, placeholder, triggerProps, open, close, toggleCustom trigger content.
valueoption, options, value, values, labelCustom selected value.
optionoption, value, label, description, isSelected, isHighlighted, isDisabled, selectCustom option row.
group-labeloption, labelCustom label row for type: "label" options.
empty—Empty state for autocomplete filtering.
loading—Loading state content.

Events

EventPayloadDescription
open-change(open, details)Fired before popup opens/closes. details.cancel() prevents the change.
value-change(value: string | string[], details)Fired before selected value updates. details.cancel() prevents the update.
search-change(value: string, details)Fired before autocomplete search updates. details.cancel() prevents the update.

Keyboard

KeyBehavior
Enter / SpaceOpen select, or select/toggle highlighted option.
ArrowDown / ArrowUpOpen select and move highlight.
Home / EndMove highlight to first/last enabled option.
EscapeClose popup.
printable characterTypeahead to matching option label.