Forms
Select
Choose one option from a list. Keyboard-first, with typeahead, and ready for search.
Installation #
With the Nuxt module, every component is auto-imported — there is nothing to add. In a plain Vue project, import what you use:
Copy
import { JSelect } from '@juxtui/ui'Usage #
Copy
<JSelect v-model="region" label="Region" :options="regions" />Options can be plain strings or objects with value, label, an optional description and disabled.
Internally, options flow through a single filtered view. Adding a search field only means setting its query — the navigation, typeahead and ARIA already work against the filtered list.
Variants & examples #
Descriptions and disabled options#
Custom rendering#
Use the option and value slots.
Validation#
API #
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| modelValue | T | null | null | Bound with v-model. T is inferred from your options. |
| options | Array<SelectOption<T> | T> | — | The options. Strings are shorthand for { value, label }. |
| placeholder | string | 'Select…' | Shown while nothing is selected. |
| label | string | — | Visible label, also used as the accessible name. |
| description | string | — | Supporting text under the control. Replaced by the error message while one is shown. |
| error | string | boolean | — | An error message, or true to mark the field invalid without a message. |
| required | boolean | false | Marks the field as required, natively and visually. |
| disabled | boolean | false | Disables the control. |
| id | string | — | Id of the control. Generated (SSR-safe) when omitted. |
| size | 'sm' | 'md' | 'lg' | 'md' | Trigger height. |
| name | string | — | Submits the value through a hidden input. |
Events
| Event | Payload | Description |
|---|---|---|
| update:modelValue | T | Emitted when an option is chosen. |
| open | — | The list opened. |
| close | — | The list closed. |
Slots
| Slot | Props | Description |
|---|---|---|
| option | { option, selected, active } | Custom option content. |
| value | { option } | Custom content for the selected value in the trigger. |
| label | — | Custom label content. |
Accessibility #
- Follows the WAI-ARIA “select-only combobox” pattern: focus never leaves the trigger, and
aria-activedescendanttells assistive technology which option is active. - Options expose
aria-selectedandaria-disabled. - The pointer only moves the active option when it actually moves, so a list opening under a resting cursor doesn’t steal the keyboard position.
Keyboard #
| Key | Action |
|---|---|
| ↓↑ | Open the list; then move between options, skipping disabled ones. |
| Enter | Open the list, or choose the active option. |
| Space | Open the list, or choose the active option (unless you are typing). |
| HomeEnd | Jump to the first or last option. |
| PageUpPageDown | Move ten options at a time. |
| A–Z | Typeahead: jump to the next option starting with the typed letters. |
| Tab | Choose the active option and move on. |
| Esc | Close without changing the value. |