Skip to content

GhostListbox reference ​

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

Themed wrappers around headless GhostListbox, GhostListboxOption, GhostListboxGroup, and GhostListboxLabel. Importing from @ghostvue/themes loads ghost-listbox.css: a bordered surface with option rows that match Select and menu rows (control.size.sm tokens for the active density), the GhostSelectOption selected fill, an inset focus ring, a coarse-pointer touch floor, and forced-colors support.

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`. Forwarded to headless GhostListbox.
defaultValueGhostListboxValueInput<Multiple>—NoInitial selection in uncontrolled mode. Copied at setup. Forwarded to headless GhostListbox.
disabledbooleanfalseNoDisables every option. The selection stays visible and unchanged. Forwarded to headless GhostListbox.
loopbooleanfalseNoArrow keys wrap from the last option to the first and back. Forwarded to headless GhostListbox.
modelValueGhostListboxValueInput<Multiple>—NoControlled selection. `undefined` is uncontrolled. Forwarded to headless GhostListbox.
multipleMultiple—NoMultiple selection (`string[]` model). Read once at setup. Forwarded to headless GhostListbox.
orientationGhostListboxOrientation"vertical"NoWhich arrow keys move focus. Horizontal arrows follow reading direction. Forwarded to headless GhostListbox.
selectionBehaviorGhostListboxSelectionBehavior"toggle"NoMultiple mode only: what a plain click or tap does. Forwarded to headless GhostListbox.
selectionFollowsFocusbooleanfalseNoSingle mode only: arrow keys, `Home` / `End`, and typeahead also select the newly focused option. Forwarded to headless GhostListbox.

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-partlistboxBordered surface with data-themed.
data-partoptionRow: hover, selected, disabled, and focus-ring styles; grows past the minimum for rich rows.
data-partgroupColumn of options under a label.
data-partlabelMuted group label.
data-statecheckedSelected option.
data-themedpresentPresent on every themed listbox part.

CSS variables ​

NameDescription
--ghost-control-size-sm-minMinimum option block size.
--ghost-surface-muted-bgSelected option background.
--ghost-elevation-2-bgHovered option background.
--ghost-focus-ring-colorFocus ring on the focused option.
--ghost-control-touch-minOption minimum block size on coarse pointers.

Accessibility ​

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

Required ARIA attributes: aria-label.

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/themes)
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/themes)
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/themes)
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/themes)
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/themes)
HomeFocuses the first enabled option.GhostListbox @component:GhostListbox › listbox/mail-list: single walkthrough, every documented key, row actions, and Axe (@ghostvue/themes)
EndFocuses the last enabled option.GhostListbox @component:GhostListbox › listbox/mail-list: single walkthrough, every documented key, row actions, and Axe (@ghostvue/themes)
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/themes)
GhostListbox fixtures @component:GhostListbox › typeahead: single, multi-character, repeated cycling, Space in a query, reset, IME, a lone Shift, and an Alt chord (@ghostvue/themes)
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/themes)
GhostListbox @component:GhostListbox › listbox/multiple: Space, Shift+Arrow, Shift+Space, Ctrl+Shift+Home / End, and Ctrl+A twice (@ghostvue/themes)
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/themes)
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/themes)
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/themes)
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/themes)
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/themes)
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/themes)
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/themes)
GhostListbox @component:GhostListbox › listbox/mail-list-multiple: multiple walkthrough with pointer, ranges, Ctrl+A, and the context menu (@ghostvue/themes)
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/themes)

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/mail-list ​

Example source

Mail list

Themed inbox with a reading pane: selection follows focus, Archive and Delete in a toolbar and in a row context menu, and focus recovery after a delete.

Inbox

Billing: Invoice 4821Your November invoice is ready to download. Nov 30
Build bot: Nightly build passedAll 1,284 checks passed on main in 14 minutes. Nov 29
Design review: Header spacingCan we tighten the gap under the page title? Nov 28
Billing: Receipt 4790Thanks, we received your payment. Nov 27
Support: Ticket 311 resolvedThe export timeout is fixed in today’s release. Nov 26

Invoice 4821

From Billing · Nov 30

Your November invoice is ready to download.

Press Shift+F10 or the Menu key for message actions.

listbox/mail-list-multiple ​

Example source

Mail list with multiple selection

Themed inbox with desktop-style replace selection, Shift and Ctrl/Cmd clicks, a selection count live region, and toolbar and context menu actions on the selection.

Triage

Billing: Invoice 4821Nov 30
Build bot: Nightly build passedNov 29
Design review: Header spacingNov 28
Billing: Receipt 4790Nov 27
Support: Ticket 311 resolvedNov 26

Shift+click selects a range and Ctrl+click (Cmd+click on macOS) adds a row. Press Shift+F10 or the Menu key for actions.

0 messages selected.

listbox/multiple ​

Example source

Multiple selection

Themed multiple listbox with the default toggle behavior: click, tap, or Space adds and removes options.

Toppings

Basil
Mozzarella
Mushroom
Olive
Roasted pepper

Selected: basil

listbox/groups ​

Example source

Groups

Themed listbox of saved views in labelled groups, with a disabled option skipped by the arrow keys.

Pinned
My open issues
Waiting for my review
Team
Needs triage
Archived board
Release blockers

listbox/horizontal ​

Example source

Horizontal

Themed horizontal listbox where ArrowLeft and ArrowRight follow reading direction, with a right-to-left switch.

XS
S
M
L
XL

Size: M