GitHubopen_in_new

Select

Select provides an anchored menu for choosing one or many options, with optional icons, filtering, and validation text.

Field spacing belongs to the surrounding layout; preserve its intended density instead of normalizing every field group to one gap. labelClearance accepts a CSS length for local block-start clearance and can inherit a subtree default from fieldContextKey; it adds to any parent gap. See the floating label spacing guide.

Anatomy

ElementPartSelector
<div>
root
[data-scope="select"][data-part="root"]
left_clickLMBCopy
<div>
trigger
[data-scope="select"][data-part="trigger"]
left_clickLMBCopy
<button>
clear-buttonconditional
[data-scope="select"][data-part="clear-button"]
left_clickLMBCopy
<Icon>
clear-icon
[data-scope="select"][data-part="clear-icon"]
left_clickLMBCopy
<span>
indicator
[data-scope="select"][data-part="indicator"]
left_clickLMBCopy
<Menu>
menu
[data-scope="select"][data-part="menu"]
<TransitionGroup>
options
[data-scope="select"][data-part="options"]
left_clickLMBCopy
<MenuItem>
option
[data-scope="select"][data-part="option"]
left_clickLMBCopy
<span>
option-leading-content
[data-scope="select"][data-part="option-leading-content"]
left_clickLMBCopy
<span>
option-check
[data-scope="select"][data-part="option-check"]
left_clickLMBCopy
<span>
option-iconconditional
[data-scope="select"][data-part="option-icon"]
left_clickLMBCopy
<div>
emptyconditional
[data-scope="select"][data-part="empty"]
left_clickLMBCopy

Props

NameDescriptionDefaultControl
labelOptional

Visible label. If omitted, provide aria-label via attrs.

string | undefined
undefined
idOptional

Optional explicit id for the trigger element.

string | undefined
undefined
optionsRequired

Selectable options rendered in the menu.

SelectOption[]
-
-
supportingTextOptional

Supporting text shown below the field when not in error state.

string | undefined
undefined
errorOptional

Error text shown below the field. When provided, field is invalid.

string | undefined
undefined
disabledOptional

Whether the control is disabled.

boolean | undefined
false
requiredOptional

Whether the control is required.

boolean | undefined
false
nameOptional

Name used for hidden inputs during form submission.

string | undefined
undefined
placeholderOptional

Placeholder shown when nothing is selected.

string | undefined
undefined
sizeOptional

The trigger height. Matches the 32px, 40px, and 56px TextField and Button sizes.

TextFieldSize | undefined
"medium"
-
labelClearanceOptional

CSS length reserved at block-start for the floating label. Overrides FieldContext.

string | undefined
undefined
multipleOptional

Enables multi-select behavior.

boolean | undefined
false
-
clearableOptional

Shows a trailing button that clears the current selection.

boolean | undefined
false
clearLabelOptional

Accessible label for the clear button.

string | undefined
undefined
menuColorOptional

Visual color style of the dropdown menu.

MenuColor | undefined
"standard"
-
displaySeparatorOptional

Separator used when showing multiple selected labels.

string | undefined
", "
filterableOptional

Enables a filter field inside the menu to narrow long option lists.

boolean | undefined
false
filterPlaceholderOptional

Placeholder shown in the menu filter field.

string | undefined
undefined
filterNoResultsTextOptional

Message shown when filtering returns no matching options.

string | undefined
undefined
modelValueOptional

-

SelectModelValue
-
-
openOptional

-

boolean | undefined
false

Events5

NameTypeDescription
update:open[value: boolean]-
update:modelValue[value: SelectModelValue]-
change[value: SelectModelValue]-
focus[event: FocusEvent]-
blur[event: FocusEvent]-

Slots6

NameParametersDescription
leading--
prefix--
suffix--
trailing--
optionLeading--
optionTrailing--

Examples

Sizes and toolbar alignment

Select uses the same extra-small (32px), small (40px), and medium (56px) trigger sizes as TextField. The default remains medium.

Default

Without Icons

Filtering

Configurations

Composable

useSelect

function useSelect(opts: UseSelectOptions): UseSelectReturn

Source: src/composables/useSelect.ts

FieldTypeRequiredDescriptionDefault
options() => UseSelectOption[]YesThe selectable options.-
multiple() => booleanYesWhether multi-select is enabled.-
filterable() => booleanYesWhether filtering is enabled.-
disabled() => booleanYesWhether the control is disabled.-
displaySeparator() => stringYesSeparator for display text in multi-select mode.-
locale(() => string | undefined) | undefinedNoBCP 47 locale used for locale-sensitive filtering.-
modelValueRef<UseSelectModelValue, UseSelectModelValue>YesModel value ref (external).-
openRef<boolean, boolean>YesOpen state ref (external).-
onChange((value: UseSelectModelValue) => void) | undefinedNoCalled when value changes.-
menuRefSelectMenuRefYesRef to the menu exposed API.-
triggerRefRef<HTMLElement | undefined, HTMLElement | undefined>YesRef to the trigger element.-
textFieldRefSelectTextFieldRefYesRef to the text field exposed API.-
FieldTypeRequiredDescriptionDefault
filterQueryRef<string, string>YesCurrent filter query string.-
selectedOptionsComputedRef<UseSelectOption[]>YesOptions selected based on current model value.-
hasValueComputedRef<boolean>YesWhether any value is selected.-
displayTextComputedRef<string>YesDisplay text for the current selection.-
submittedValuesComputedRef<string[]>YesValues to submit in hidden form inputs.-
filteredOptionEntriesComputedRef<{ option: UseSelectOption; index: number; }[]>YesFiltered option entries with original indices.-
hasFilteredOptionsComputedRef<boolean>YesWhether there are any filtered options.-
isOptionSelected(option: UseSelectOption) => booleanYesCheck if an option is currently selected.-
toggleOption(option: UseSelectOption) => voidYesToggle an option in the selection.-
clearValue() => voidYesClear the current selection.-
handleMenuSelect(event: MouseEvent, itemElement: HTMLElement) => voidYesHandle menu item selection event.-
focus() => voidYesFocus the text field.-
blur() => voidYesBlur the text field.-
show() => Promise<void>YesShow the menu.-
hide() => voidYesHide the menu.-
toggle() => voidYesToggle the menu.-
openMenu(focus?: "first" | "last") => voidYesOpen menu with optional focus target.-
closeMenu() => voidYesClose the menu.-
handleFieldClick() => voidYesHandle click on the trigger field.-
handleFieldInput() => voidYesHandle input on the filter field.-
handleFilterKeydown(event: KeyboardEvent) => voidYesHandle keydown on the filter field.-