Skip to content

Select

A dropdown selector supporting single/multiple selection, groups, clearable, remote search, and custom creation, with full keyboard operation.

Single Select

Single select

Preset Value

Preset value

Multiple Select

Multiple

In multiple mode value is a JSON array; selected items are shown as tags that can be removed individually. Tags wrap to new lines by default and the trigger grows with the content (no collapsing unless max-tag-count is set).

Disabled

Disabled

Empty State

No data

When options are empty, the dropdown shows "暂无数据".

Searchable

Searchable

Once opened, you can type directly to filter; when nothing matches, "无匹配选项" is shown.

Groups

Grouped

Grouped multiple

Options carrying a group field are rendered under a group title (not selectable), with items indented; keyboard / navigates continuously across groups.

Clearable

Clearable

When a value is selected, a clear button appears; clicking clears the value and dispatches oas-clear and oas-change.

Remote search (remote + loading)

In remote mode the component does no local filtering: typing dispatches oas-input for the host to request data, and the host sets loading during the request to show a loading placeholder. This example simulates an 800ms delayed filter:

Remote loading placeholder

Tag Collapse

Tag collapse (max-tag-count)

Multiple-select tags wrap by default and do not collapse; only when max-tag-count is explicitly set do they collapse into +N (hover to see the remaining items).

Allow Create

Allow create

When search yields no match, a "创建 xxx" item is shown; clicking or pressing Enter creates a new option from the input value and selects it.

Events

Change events

Listen to oas-change; detail.value is a string for single select and an array for multiple:

API

Attributes

AttributeDescriptionTypeDefault
allow-createAllow creating new options from the input value when nothing matchesboolean
clearableClearable (shows a clear button when a value exists; clearing dispatches oas-clear)boolean
disabledDisabledboolean
loadingRemote loading placeholder (use with remote)boolean
max-tag-countCollapse tags beyond this count into +N in multiple mode (opt-in; without it tags wrap instead of collapsing)boolean
multipleMultiple selectboolean
optionsOptions, JSON array [{ label, value, disabled?, group? }]Option[] | string[]
placeholderPlaceholder text
remoteRemote search: no local filtering, typing dispatches oas-input for the host to requestboolean
searchableSearchable (type to filter after opening the dropdown)boolean
valueCurrent value (JSON array in multiple mode)

Events

EventDescription
oas-changeSelection/clear change, detail: { value }
oas-clearClear button clicked, detail: { value } (value before clearing)
oas-inputInput in remote mode, detail: { value } (for host requests)

Options carrying a group field are rendered under a group title (not selectable), items are indented; keyboard navigation continues across groups.

Keyboard: Enter / to open, / to move the highlight (works inside the search box too), Enter to select, Esc to close.