Skip to content

GhostListbox reference ​

Package: @ghostvue/vue. Status: experimental (stability policy).

Standalone, always-visible role="listbox" (WAI-ARIA APG listbox) with single or multiple selection. One Tab stop rendered as tabindex (no aria-activedescendant), arrow / Home / End / typeahead movement, the APG multi-select keys, desktop-style pointer ranges with selectionBehavior, focus recovery when options are removed, and a context-menu handshake inside GhostContextMenuTrigger focus-target="descendant". Requires aria-label or aria-labelledby.

Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.

All component references

Props ​

NameTypeDefaultRequiredDescription
asGhostListboxElement"div"NoHost element. Options inside a `ul` / `ol` root use `as="li"`; groups are supported only with the default `div`.
defaultValueGhostListboxValueInput<Multiple>—NoInitial selection in uncontrolled mode. Copied at setup.
disabledbooleanfalseNoDisables every option. The selection stays visible and unchanged.
loopbooleanfalseNoArrow keys wrap from the last option to the first and back.
modelValueGhostListboxValueInput<Multiple>—NoControlled selection. `undefined` is uncontrolled.
multipleMultiple—NoMultiple selection (`string[]` model). Read once at setup.
orientationGhostListboxOrientation"vertical"NoWhich arrow keys move focus. Horizontal arrows follow reading direction.
selectionBehaviorGhostListboxSelectionBehavior"toggle"NoMultiple mode only: what a plain click or tap does.
selectionFollowsFocusbooleanfalseNoSingle mode only: arrow keys, `Home` / `End`, and typeahead also select the newly focused option.

Emits ​

None declared.

Models ​

PropEventTypeDescription
modelValueupdate:modelValueGhostListboxValueInput<Multiple>v-model binding for `modelValue`.

Slots ​

NameDescription
default`GhostListboxOption` and `GhostListboxGroup` children.

Slot props: default ​

NameTypeDescription
activeValuestring | undefinedValue of the tab-stop option, or `undefined` when the root is the stop.
selectedValuesreadonly string[]Current selection in model order, duplicates removed.

Exposed members ​

NameTypeDescription
blur() => voidExposed method `blur`.
elementHTMLElement | nullExposed property `element`.
focus(options?: FocusOptions) => voidFocuses the current tab stop (the active option, or the root).
focusOption(value: string, options?: FocusOptions) => booleanMoves the tab stop and DOM focus to the option with `value` and scrolls it into view (`block: 'nearest'`) unless `options.preventScroll` is set. Returns `false` when that option is not mounted or is disabled. Never changes the selection.

Parts and data attributes ​

AttributeValueDescription
data-partlistboxrole="listbox" root rendered by GhostListbox.
data-orientationvertical, horizontalMirrors aria-orientation on the root.
data-multiplepresentPresent on the root in multiple mode.
data-disabledpresentPresent on a disabled root.

CSS variables ​

None declared.

Accessibility ​

Role: listbox. APG pattern: https://www.w3.org/WAI/ARIA/apg/patterns/listbox/.

Required ARIA attributes: aria-label, aria-orientation.

Keyboard ​

KeyActionAutomated browser test
TabMoves focus into and out of the listbox through its single tab stop: the active option, else the root of an empty or disabled list.GhostListbox @component:GhostListbox › listbox/mail-list: single walkthrough, every documented key, row actions, and Axe (@ghostvue/vue)
ArrowDownVertical: focuses the next enabled option (wraps only with loop). Single mode with selectionFollowsFocus also selects it.GhostListbox @component:GhostListbox › listbox/mail-list: single walkthrough, every documented key, row actions, and Axe (@ghostvue/vue)
ArrowUpVertical: focuses the previous enabled option (wraps only with loop). Single mode with selectionFollowsFocus also selects it.GhostListbox @component:GhostListbox › listbox/mail-list: single walkthrough, every documented key, row actions, and Axe (@ghostvue/vue)
ArrowRightHorizontal: focuses the next enabled option in reading order (the previous one in RTL).GhostListbox @component:GhostListbox › listbox/horizontal: ArrowLeft and ArrowRight follow reading order in LTR and RTL (@ghostvue/vue)
ArrowLeftHorizontal: focuses the previous enabled option in reading order (the next one in RTL).GhostListbox @component:GhostListbox › listbox/horizontal: ArrowLeft and ArrowRight follow reading order in LTR and RTL (@ghostvue/vue)
HomeFocuses the first enabled option.GhostListbox @component:GhostListbox › listbox/mail-list: single walkthrough, every documented key, row actions, and Axe (@ghostvue/vue)
EndFocuses the last enabled option.GhostListbox @component:GhostListbox › listbox/mail-list: single walkthrough, every documented key, row actions, and Axe (@ghostvue/vue)
a-zPrintable characters run a 500 ms typeahead on textValue; Space is part of a non-empty query.GhostListbox @component:GhostListbox › listbox/mail-list: single walkthrough, every documented key, row actions, and Axe (@ghostvue/vue)
GhostListbox fixtures @component:GhostListbox › typeahead: single, multi-character, repeated cycling, Space in a query, reset, IME, a lone Shift, and an Alt chord (@ghostvue/vue)
Single mode: selects the focused option. Multiple mode: toggles it and sets the selection anchor.GhostListbox @component:GhostListbox › listbox/mail-list: single walkthrough, every documented key, row actions, and Axe (@ghostvue/vue)
GhostListbox @component:GhostListbox › listbox/multiple: Space, Shift+Arrow, Shift+Space, Ctrl+Shift+Home / End, and Ctrl+A twice (@ghostvue/vue)
EnterSingle mode: selects the focused option. Not handled in multiple mode, so consumer keydown handlers can use it.GhostListbox @component:GhostListbox › listbox/mail-list: single walkthrough, every documented key, row actions, and Axe (@ghostvue/vue)
Shift+ArrowDownMultiple mode: focuses the next enabled option and toggles its selection; the anchor stays.GhostListbox @component:GhostListbox › listbox/multiple: Space, Shift+Arrow, Shift+Space, Ctrl+Shift+Home / End, and Ctrl+A twice (@ghostvue/vue)
Shift+ArrowUpMultiple mode: focuses the previous enabled option and toggles its selection; the anchor stays.GhostListbox @component:GhostListbox › listbox/multiple: Space, Shift+Arrow, Shift+Space, Ctrl+Shift+Home / End, and Ctrl+A twice (@ghostvue/vue)
Shift+SpaceMultiple mode: selects every enabled option from the anchor to the focused option.GhostListbox @component:GhostListbox › listbox/multiple: Space, Shift+Arrow, Shift+Space, Ctrl+Shift+Home / End, and Ctrl+A twice (@ghostvue/vue)
Control+Shift+HomeMultiple mode (Cmd on macOS): selects from the focused option to the first and focuses it.GhostListbox @component:GhostListbox › listbox/multiple: Space, Shift+Arrow, Shift+Space, Ctrl+Shift+Home / End, and Ctrl+A twice (@ghostvue/vue)
Control+Shift+EndMultiple mode (Cmd on macOS): selects from the focused option to the last and focuses it.GhostListbox @component:GhostListbox › listbox/multiple: Space, Shift+Arrow, Shift+Space, Ctrl+Shift+Home / End, and Ctrl+A twice (@ghostvue/vue)
Control+AMultiple mode (Cmd on macOS): selects every enabled option, or deselects them all when all are selected.GhostListbox @component:GhostListbox › listbox/multiple: Space, Shift+Arrow, Shift+Space, Ctrl+Shift+Home / End, and Ctrl+A twice (@ghostvue/vue)
GhostListbox @component:GhostListbox › listbox/mail-list-multiple: multiple walkthrough with pointer, ranges, Ctrl+A, and the context menu (@ghostvue/vue)
EscapeNot handled or default-prevented, so an enclosing dialog or drawer still closes.GhostListbox fixtures @component:GhostListbox › Escape inside a dialog closes the dialog (@ghostvue/vue)

Verification ​

Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.

CategoryStatusEvidence
Automated keyboardPassedEvery declared key maps to a Chromium browser test that CI runs and requires to pass on every commit.
Manual interactionNot reviewedNo review recorded.
Assistive technologyNot reviewedNo review recorded.

Examples ​

listbox/basic ​

Example source

Basic Headless

Headless single-selection listbox with consumer CSS on the data-part and aria-selected hooks.

US East
US West
EU Central
Asia Pacific South

Deploying to us-east