Shopware Design

Select

Source

Usage

Select lets users pick one or more values from a list of predefined options instead of entering free-form text. Use it when the list may be longer than a simple inline choice group would comfortably show, or when searching, custom option labels, or multi selection would improve the picking experience.

import { MtSelect } from "@shopware-ag/meteor-component-library";

Examples

Multiple selection

Enable enableMultiSelection so users can choose several values at once.

API reference

Props

PropTypeDefault
options *
An array of objects with the labelProperty and valueProperty.
unknown[]
error
An error in your business logic related to this field. For example: {"code": 500, "detail": "Error while saving"}
Record<string, any>null
label
The label for the select field itself.
string""
is-inheritance-field
Determines if the field is inheritable.
booleanfalse
is-inherited
Toggles the inheritance visualization.
booleanfalse
disabled
Disables or enables the select field.
booleanfalse
placeholder
The placeholder for the select field.
string""
model-value
Dependent on multiSelection, either a single value or an array of values.
string | number | boolean | object | unknown[] | nullnull
small
Render the select field in small without a search input
booleanfalse
disable-inheritance-toggle
Determines the active state of the inheritance toggle.
booleanfalse
is-loading
Toggles the loading state of the select field.
booleanfalse
label-property
The object key of the label property. Can be a single string or an array of strings. If an array is provided, the first property that has a non-empty value will be used.
string | string[]"label"
value-property
The object key to use for the value.
string"value"
always-show-placeholder
Determines if the placeholder should be shown even when there are no selections.
booleantrue
enable-multi-selection
Toggles if either one or more items can be selected.
booleanfalse
value-limit
The number of items that are expanded by default.
number5
hide-clearable-button
Toggles a button to clear all selections.
booleanfalse
highlight-search-term
Determines to highlight the searched term or not.
booleantrue
search-function
Used to implement a custom search function. Parameters passed: { options, labelProperty, valueProperty, searchTerm }
Function({ options, labelProperty, searchTerm, }: { options: any; labelProperty: string | string[]; searchTerm: string; }) => { return options.filter((option: any) => { // If labelProperty is an array, check each property if (Array.isArray(labelProperty)) { for (const property of labelProperty) { const label = getPropertyValue(option, property); if (label && typeof label === "string" && label.toLowerCase().includes(searchTerm.toLowerCase())) { return true; } } return false; } // Original behavior for string labelProperty const label = getPropertyValue(option, labelProperty); if (!label) { return false; } return label.toLowerCase().includes(searchTerm.toLowerCase()); }); }
on-update:model-value((...args: any[]) => any) | undefined
on-change((...args: any[]) => any) | undefined
on-inheritance-remove((...args: any[]) => any) | undefined
on-inheritance-restore((...args: any[]) => any) | undefined
on-item-add((...args: any[]) => any) | undefined
on-item-remove((...args: any[]) => any) | undefined
on-display-values-expand((...args: any[]) => any) | undefined
on-paginate((...args: any[]) => any) | undefined
on-search-term-change((...args: any[]) => any) | undefined

Exposed

NameType
tComposerTranslation<{ en: { messageNoResults: string; }; de: { messageNoResults: string; }; }, "en" | "de", RemoveIndexSignature<{ [x: string]: LocaleMessageValue<VueMessageType>; }>, never, "messageNoResults", "messageNoResults">
getKeyany
searchTermstring
limitnumber
searchResultsnever[]
isSearchResultsLoadingboolean
visibleValuesany[]
totalValuesCountnumber
invisibleValueCountnumber
currentValuestring | number | boolean | object | unknown[] | null
visibleResultsany[]
componentClassesRecord<string, boolean>

Best practices

Do
  • Use a clear field label so users understand what they are choosing.
  • Keep option labels concise and easy to scan.
  • Use enableMultiSelection only when selecting multiple values is a real user need.
  • Set labelProperty and valueProperty explicitly when your option shape differs from the defaults.
  • Add hint or help text when the selection rules need extra explanation.
Don't
  • Do not use Select when users should enter arbitrary text instead of choosing from known values.
  • Do not use a long select list when a smaller visible choice group would be easier to compare directly.
  • Do not rely on placeholder text as the only instruction for the field.
  • Do not mix unclear or duplicated option labels, especially in searchable lists.
  • Do not enable multi selection when the form should store exactly one value.

Behavior

  • Select supports both single and multiple selection. modelValue can be a single value, an option object, or an array depending on the selection mode and valueProperty.
  • The component searches within the provided options by default and supports a custom searchFunction when filtering needs to follow business-specific rules.
  • labelProperty can be a string or an array of property paths. When an array is used, the first non-empty value is used as the visible label.
  • Shared field features such as hint, error, prefix and suffix content, and inheritance handling work the same way as in other form fields.
  • small renders a compact variant without the inline search input, which is better suited to tighter layouts.
  • Use selectionLabelProperty to customize how selected items are rendered in the closed field.
  • Use the result-item slot or resultLabelProperty when result rows need richer formatting than a plain text label.
  • Use the before-item-list and after-item-list slots for supporting content around the result list, such as guidance or actions.

Accessibility

  • Provide a clear field label or other nearby visible context so users understand what the selection controls.
  • Keep option labels distinct so users can tell similar choices apart while searching or navigating with the keyboard.
  • Use help text when multiple selection, custom option rendering, or inherited values might otherwise be unclear.
  • Radio Group: when a small set of options should stay visible so users can compare them directly.
  • Checkbox: when users are toggling independent options on and off rather than choosing from a shared option set.