Skip to main content

Multiselect

Pick several values, shown as removable tags.

pii finance certified
<mm-multiselect name="tags" label="Tags" value="pii,finance" placeholder="Add tags">
<mm-option value="pii">pii</mm-option>
<mm-option value="finance">finance</mm-option>
<mm-option value="certified">certified</mm-option>
</mm-multiselect>

Guidance​

Multiselects pick several values, such as tags (pii, finance, certified), owners or providers for a filter. Chosen values sit inside the field as removable tags (sunken, radius-sm, like mm-tag); after max-tags the rest collapse to “+3” until the field has focus. Each value submits as its own FormData entry under the same name, like a native <select multiple>. Options can come from slotted mm-option elements or an async loader.

Keyboard follows the WAI-ARIA editable combobox pattern with a multi-selectable listbox: Down and Up open and move, Enter toggles the highlighted option and keeps the list open, Escape closes and then clears the text, Backspace in an empty field removes the last value. Left arrow from the start of the field moves through the tags; Backspace or Delete removes the focused tag.

Properties​

PropertyAttributeTypeDefaultDescription
valuevaluestring[][]The selected values. As an attribute, a comma-separated list.
maxTagsmax-tagsnumber3Tags shown before the rest collapse to “+N” (all show while the field has focus).
hideLabelhide-labelbooleanfalseVisually hide the label (it is still announced).

Events​

EventDetailDescription
mm-changeCustomEvent<{ value: string[] }>The values changed by user action.
mm-inputCustomEvent<{ query: string }>The typed text changed.
changeNative-style change event.

Slots​

SlotDescription
Defaultmm-option and mm-option-group elements, when not using loader.

CSS parts​

PartDescription
controlThe field box.
tagEach value tag.
inputThe text input.
popupThe floating panel.
listboxThe listbox.

Examples​

Every state of mm-multiselect in Storybook, with keyboard and screen reader tests.