Skip to content

Selector

@astryxdesign/core v0.7.1 · Selector

Selector Props ​

NameTypeDefaultDescription
modelValuestring | number | nullnullSelected value.
optionsSelectorOption[]RequiredOptions. An action on any item latches the popup into a two-column grid. Activating the action does not change the selection.
placeholderstringSelect… / 请选择Placeholder text. English by default; Chinese when zh-CN is provided.
searchablebooleanfalseWhether to support search.
clearablebooleanfalseWhether clearable.
hasClearbooleanfalseShows a clear button when a value is selected. The clear also passes null to change. clearable is the older name; either one turns it on.
disabledbooleanfalseWhether disabled.
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.
size'sm' | 'md' | 'lg''md'Size.
variant'input' | 'secondary' | 'ghost' | 'default''default'input and the older name default are the bordered field. secondary matches a secondary button. ghost is borderless. On the latter two, an attached status becomes detached.
isLabelHiddenbooleanfalseHides the label visually. The accessible name stays.
containerClass / containerStyleclass / style—Styles for the field shell. They do not land on the trigger button.
controlClass / controlStyleclass / style—Styles for the bordered box. A class or style on the component root lands here too.
status'default' | 'error' | 'warning' | 'success''default'Status.
labelstring—Visible label. Without it, the placeholder is the hidden accessible name.
descriptionstring—Help text under the label.
isReadOnlybooleanfalseRead-only. The value stays, can be focused and submitted, and cannot be opened or cleared. It does not dim. Disabled wins when both are set.
isLoadingbooleanfalseShows a spinner in the trigger. The empty state stays hidden until loading finishes.
isOptionalbooleanfalseMarks the label as optional.
isRequiredbooleanfalseMarks the label as required and sets aria-required.
indicatorPosition'start' | 'end''end'Which edge of the option holds the selection mark. An unchosen check takes no space. After the theme maps that mark to a circle, an unchosen row draws the empty circle too.
emptyTextstringNo matches / 无匹配项Shown when the catalog itself is empty.
emptySearchTextstringNo results found / 未找到结果Shown when a search matches nothing.

Selector Emits ​

NameParametersDescription
update:modelValuevalue: string | number | nullEmitted when value changes.
changevalue: string | number | nullEmitted when value changes.
searchquery: stringEmitted when search input changes.
clickevent: MouseEventEmitted for a click on the trigger, before the list toggles. preventDefault() does not keep it closed.
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.

Selector Slots ​

NameParametersDescription
selected{ option: SelectorOption | null }Customize selected item display.
option{ option: SelectorOption, isActive: boolean, isSelected: boolean }Customize option display.
empty—Customize empty state.