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
Value: "na"
Nothing chosen yet
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.
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.
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.
Value: null
Small, in a toolbar
Disabled, with the reason
Only an account owner can change the plan.
Invalid
Choose a term to clear the error.
Choose a billing term to continue.
API
| Name | Type | Default | Description |
|---|---|---|---|
v-model | string | number | null | null | The chosen option's value. |
v-model:open | boolean | false | Whether the listbox is open. |
options | EcoOption[] | — | { label, value, hint?, disabled? } — a disabled option stays listed with a hint saying why. |
placeholder | string | "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. |
labelledby | string | — | 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. |
searchable | boolean | false | A 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. |
searchPlaceholder | string | "Search" | Placeholder of the search box. |
filter | boolean | (option, query) => boolean | true | true matches label and hint (case-insensitive); false leaves options as given, for server-side search; or your own test. The query arrives trimmed. |
clearable / clearLabel | boolean / string | false / "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 / loadingText | boolean / string | false / "Loading options…" | The open list shows a status row instead of the options; the listbox is aria-busy. |
emptyText | string | "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 / #option | slot | — | 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. |