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#

Copy
<script setup lang="ts">
const plan = ref('pro')

const plans = [
  { value: 'hobby', label: 'Hobby', description: 'For personal projects' },
  { value: 'pro', label: 'Pro', description: 'For small teams' },
  { value: 'scale', label: 'Scale', description: 'For growing companies' },
  { value: 'enterprise', label: 'Enterprise', description: 'Contact sales', disabled: true },
]
</script>

<template>
  <JSelect v-model="plan" label="Plan" :options="plans" />
</template>

Custom rendering#

Use the option and value slots.

Validation#

API #

Props

PropTypeDefault Description
modelValueT | nullnullBound with v-model. T is inferred from your options.
optionsArray<SelectOption<T> | T>—The options. Strings are shorthand for { value, label }.
placeholderstring'Select…'Shown while nothing is selected.
labelstring—Visible label, also used as the accessible name.
descriptionstring—Supporting text under the control. Replaced by the error message while one is shown.
errorstring | boolean—An error message, or true to mark the field invalid without a message.
requiredbooleanfalseMarks the field as required, natively and visually.
disabledbooleanfalseDisables the control.
idstring—Id of the control. Generated (SSR-safe) when omitted.
size'sm' | 'md' | 'lg''md'Trigger height.
namestring—Submits the value through a hidden input.

Events

EventPayload Description
update:modelValueTEmitted when an option is chosen.
open—The list opened.
close—The list closed.

Slots

SlotProps 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-activedescendant tells assistive technology which option is active.
  • Options expose aria-selected and aria-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.
EnterOpen the list, or choose the active option.
SpaceOpen the list, or choose the active option (unless you are typing).
HomeEndJump to the first or last option.
PageUpPageDownMove ten options at a time.
A–ZTypeahead: jump to the next option starting with the typed letters.
TabChoose the active option and move on.
EscClose without changing the value.