Forms / Select

Forms

Select

A single choice from a short list: a combobox trigger opening a listbox under it.

import { EcoSelect } from "vue-ecosphere"

Closed, with a label

Region

Value: "na"

Nothing chosen yet

Owner

The owner gets every reply on this request.

Value: null

Chosen, highlighted, disabled

Open it and use the arrow keys: the highlight skips Lyon, which stays listed with its reason.

Site

Searchable and clearable

For a long list: type to filter by name or team, ↑ ↓ to move, Enter to choose. The × clears the choice; so do Delete and Backspace on the trigger.

Assignee

Value: "grace"

Server-side search

With filter set to false the list shows the options as given: answer @search by loading and replacing them. The trigger keeps the chosen label while the results leave it out.

Hub airport

Value: null

Small, in a toolbar

Period

Disabled, with the reason

Plan

Only an account owner can change the plan.

Invalid

Choose a term to clear the error.

Billing term

Choose a billing term to continue.

API

NameTypeDefaultDescription
v-modelstring | number | nullnullThe chosen option's value.
v-model:openbooleanfalseWhether the listbox is open.
optionsEcoOption[]—{ label, value, hint?, disabled? } — a disabled option stays listed with a hint saying why.
placeholderstring"Choose an option"Say what to choose (data-placeholder while empty).
size"md" | "sm""md"sm (32px) for toolbars; md inside forms to line up with input.
labelledbystring—Id of an external label when there is no label prop.
label / required / hint / error / invalid / first / disabled / id——Field props. The error sets aria-invalid on the trigger.
searchablebooleanfalseA menu__find search box at the top of the open list. It takes focus when the list opens and is the combobox (aria-activedescendant, aria-autocomplete="list"); the trigger stays a button. The query resets when the list closes.
searchPlaceholderstring"Search"Placeholder of the search box.
filterboolean | (option, query) => booleantruetrue matches label and hint (case-insensitive); false leaves options as given, for server-side search; or your own test. The query arrives trimmed.
clearable / clearLabelboolean / stringfalse / "Clear"A × before the chevron while a value is chosen; it (and Delete or Backspace on the closed trigger) sets the model to null without opening the list. Only where no answer is valid.
loading / loadingTextboolean / stringfalse / "Loading options…"The open list shows a status row instead of the options; the listbox is aria-busy.
emptyTextstring"No matches" / "No options"Shown in menu__empty when nothing is listed: the first default while a query is typed, the second otherwise.
@search(query: string)—The query as it is typed, and "" when the list closes. Pair with :filter="false" and replace options.
@clear()—The × or Delete/Backspace cleared the value.
#value / #optionslot—Custom trigger text / option content.
Keyboard——↑ ↓ Home End move, Enter/Space choose, Escape closes, typing jumps to a match. Searchable: typing on the trigger opens the list and searches; in the box, ↑ ↓ Home End move, Enter chooses, Escape closes and returns focus, Tab closes.