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.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
as | GhostListboxElement | "div" | No | Host element. Options inside a `ul` / `ol` root use `as="li"`; groups are supported only with the default `div`. |
defaultValue | GhostListboxValueInput<Multiple> | — | No | Initial selection in uncontrolled mode. Copied at setup. |
disabled | boolean | false | No | Disables every option. The selection stays visible and unchanged. |
loop | boolean | false | No | Arrow keys wrap from the last option to the first and back. |
modelValue | GhostListboxValueInput<Multiple> | — | No | Controlled selection. `undefined` is uncontrolled. |
multiple | Multiple | — | No | Multiple selection (`string[]` model). Read once at setup. |
orientation | GhostListboxOrientation | "vertical" | No | Which arrow keys move focus. Horizontal arrows follow reading direction. |
selectionBehavior | GhostListboxSelectionBehavior | "toggle" | No | Multiple mode only: what a plain click or tap does. |
selectionFollowsFocus | boolean | false | No | Single mode only: arrow keys, `Home` / `End`, and typeahead also select the newly focused option. |
Emits
None declared.
Models
| Prop | Event | Type | Description |
|---|---|---|---|
modelValue | update:modelValue | GhostListboxValueInput<Multiple> | v-model binding for `modelValue`. |
Slots
| Name | Description |
|---|---|
default | `GhostListboxOption` and `GhostListboxGroup` children. |
Slot props: default
| Name | Type | Description |
|---|---|---|
activeValue | string | undefined | Value of the tab-stop option, or `undefined` when the root is the stop. |
selectedValues | readonly string[] | Current selection in model order, duplicates removed. |
Exposed members
| Name | Type | Description |
|---|---|---|
blur | () => void | Exposed method `blur`. |
element | HTMLElement | null | Exposed property `element`. |
focus | (options?: FocusOptions) => void | Focuses the current tab stop (the active option, or the root). |
focusOption | (value: string, options?: FocusOptions) => boolean | Moves 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
| Attribute | Value | Description |
|---|---|---|
data-part | listbox | role="listbox" root rendered by GhostListbox. |
data-orientation | vertical, horizontal | Mirrors aria-orientation on the root. |
data-multiple | present | Present on the root in multiple mode. |
data-disabled | present | Present 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
Verification
Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.
| Category | Status | Evidence |
|---|---|---|
| Automated keyboard | Passed | Every declared key maps to a Chromium browser test that CI runs and requires to pass on every commit. |
| Manual interaction | Not reviewed | No review recorded. |
| Assistive technology | Not reviewed | No review recorded. |
Examples
listbox/basic
Headless single-selection listbox with consumer CSS on the data-part and aria-selected hooks.