Skip to content

Multi Selector

@astryxdesign/core v0.7.1 · MultiSelector

MultiSelector Props ​

NameTypeDefaultDescription
modelValue(string | number)[][]Selected values.
optionsMultiSelectorOption[]RequiredStrings, option objects, dividers, or sections.
labelstringRequiredField label.
isLabelHiddenbooleanfalseHides the label visually while keeping it accessible. labelHidden is the older name; either one hides it.
placeholderstringSelect… / 请选择Placeholder when nothing is selected.
searchablebooleanfalseShow a search field in the menu.
selectAllbooleanfalseShow a select-all row. Disabled options are skipped.
triggerDisplay'count' | 'labels' | 'badges''count'How the closed trigger shows the selection.
maxBadgesnumber3How many badges or labels stay visible before +N. Width can collapse them further.
clearablebooleanfalseShow a clear button.
hasClearbooleanfalseShows a clear button when values are selected. clearable is the older name; either one turns it on.
checkboxPosition'start' | 'end''start'Where the check mark sits.
variant'input' | 'secondary' | 'ghost''input'input has a border. secondary matches a secondary button. ghost fits a toolbar. On the latter two, an attached status becomes detached.
containerClass / controlClassclass—Shell and trigger box. A root class lands on the box. An option action latches a two-column grid and does not change the selection.
disabledbooleanfalseDisable the field.
disabledMessagestring—Why the field is disabled. With disabled, hovering or keyboard focus shows a tooltip and the trigger stays focusable through aria-disabled; it still cannot open the list. Do not wrap a disabled selector in a tooltip: it would swallow the hover. disabledReason is the older name.
disabledReasonstring—Reason for the disabled state. The control stays focusable. Same as disabledMessage.
isDefaultOpenbooleanfalseStarts with the list open on mount.
status'default' | 'success' | 'warning' | 'error''default'Status style.
statusMessagestring—Status text under the field.
statusVariant'attached' | 'detached' | 'tooltip''attached'Where the status message sits. Ghost detaches an attached message. Tooltip keeps it on the icon inside the field.
size'sm' | 'md' | 'lg''md'Size.
namestring—Form field name. Each selected value is submitted once.
isReadOnlybooleanfalseRead-only. The selection stays, can be focused and submitted, and cannot be opened or cleared. It does not dim.
isLoadingbooleanfalseShows a spinner in the trigger. The create row and the empty state stay hidden.
formatValue(items) => string—Custom closed text. Used by count and labels only. Badges ignore it. An empty selection does not call it.
hasCreatebooleanfalseUse with search. When the text matches no label, ignoring case, the first row creates it.
handleRefRef | (handle) => void—Open, close, or ask whether the menu is open. Pass a function from a template. Open does nothing when read-only or disabled.
emptyTextstringNo matches / 无匹配项Shown when the list itself has no options.
emptySearchTextstringNo results found / 未找到结果Shown when a search matches nothing.

MultiSelector Emits ​

NameParametersDescription
update:modelValuevalue: (string | number)[]Emitted when the selection changes.
changevalue, change?Emitted when the selection changes. A create also passes { type: 'create', query }.
searchquery: stringEmitted when the search text changes.
openChangeisOpen: booleanEmitted when the menu opens or closes.
clickevent: MouseEventEmitted for a click on the trigger, after the menu toggles. It cannot cancel the toggle.
focusevent: FocusEventEmitted when the trigger takes focus.
keydownevent: KeyboardEventEmitted for keys on the trigger that the built-in keyboard model leaves alone. Keys it handles and cancels are not emitted.

MultiSelector Slots ​

NameParametersDescription
icon—Icon at the start of the trigger.
option{ option, selected, active }Custom option.
empty—Custom empty state.
trigger{ id, onClick, onKeyDown, onFocus, aria-haspopup, aria-expanded, aria-controls, aria-busy, triggerRef }Replaces the whole field and trigger with your own control (a glyph in a row, a chip, an icon button). Spread the bindings onto it and pass triggerRef as :ref so the list anchors to it. The field chrome (label, status, clear, spinner) is not rendered.