@rozie-ui/combobox-vue

Idiomatic Vue headless WAI-ARIA combobox / autocomplete (text input + popup listbox, client/async filtering, full keyboard navigation, aria-activedescendant) — one accessible Rozie source compiled to Vue.
2,591 1
Install
npm install @rozie-ui/combobox-vue
Latest Version:0.8.1
Vue:3
License:MIT
Last Updated:Oct 15, 2026
Links: GitHub  ·  npm
Maintainer: serpentblade

@rozie-ui/combobox-vue

Idiomatic vue Combobox — a headless, fully-accessible (WAI-ARIA) combobox / autocomplete: a text input plus a popup listbox with aria-activedescendant keyboard navigation (Arrow/Home/End/Enter/Escape), built-in client-side filtering (or async/server-side via the search event + disableFilter), a custom-option scoped slot, and a two-way value binding — compiled from one Rozie source. There is NO third-party engine; the behaviour is authored once on native DOM. Every visual value is a CSS custom property, so it re-skins to any design system. This package is generated; do not edit src/ by hand.

Install

npm i @rozie-ui/combobox-vue

Peer dependencies: vue. Install them alongside this package.

Required peers — beyond the framework peer above, this package requires these non-optional peers to actually render:

  • @rozie-ui/popover-vue ^0.2.0 || ^0.3.0 — required by @rozie-ui/combobox-vue
  • @tanstack/virtual-core ^3 — required by @rozie-ui/combobox-vue
  • @floating-ui/dom ^1.7.2 — required by @rozie-ui/popover-vue

Install the whole chain in one line:

npm i @rozie-ui/combobox-vue @rozie-ui/popover-vue @tanstack/virtual-core @floating-ui/dom

Also installed: @rozie/runtime-vue — Rozie's small, tree-shaken runtime helper package (controllable state, keyboard navigation, event modifiers, and safe interpolation). It arrives as a regular dependency, so npm pulls it for you. This build imports nothing from it today, so it shakes out of your bundle entirely. What's in it and what it costs.

Usage

<script setup lang="ts">
import { ref } from 'vue';
import Combobox from '@rozie-ui/combobox-vue';

const value = ref<string | null>(null);
const frameworks = [
  { value: 'react', label: 'React' },
  { value: 'vue', label: 'Vue' },
  { value: 'svelte', label: 'Svelte' },
  { value: 'solid', label: 'Solid' },
];
function onChange(e: { value: unknown }) {
  console.log('picked:', e.value);
}
</script>

<template>
  <Combobox v-model:value="value" :options="frameworks" placeholder="Search…" aria-label="Framework" @change="onChange" />

  <!-- Custom option rendering via the #option scoped slot -->
  <Combobox v-model:value="value" :options="frameworks">
    <template #option="{ option, selected }">
      <strong v-if="selected">{{ option.label }}</strong>
      <span v-else>{{ option.label }}</span>
    </template>
  </Combobox>
</template>

Theming

Every visual value is a --rozie-combobox-* CSS custom property — override any of them at any ancestor scope. Ready-made design-system bridges ship in the package:

import '@rozie-ui/combobox-vue/themes/shadcn.css';    // or material.css, bootstrap.css, base.css

Props

Name Type Default Two-way (model) Required
value unknown null ✓
options Array []
placeholder String ''
disabled Boolean false
disableFilter Boolean false
ariaLabel String null
idBase String ''
inline Boolean false
closeOnSelect Boolean null
multiple Boolean false
creatable Boolean false
optionLabel Function null
optionValue Function null
optionDisabled Function null
virtual Boolean false
estimateRowHeight Number 36
maxHeight String ''
groups Array []
groupCap Number 0
placement String "bottom-start"
offset Number 4
disableFlip Boolean false
disableShift Boolean false
block Boolean false
chipLayout String "stacked"
disableOpenOnFocus Boolean false
hideEmpty Boolean false
delimiters Array []
validate Function null
splitPaste Function null
commitOnBlur Boolean false
selectOnTab Boolean false

Events

Event Description
search Fired whenever the input text changes. Payload { query } — the current text. It fires on every keystroke, after a paste Combobox handles itself (with the resulting text), and with { query: '' } whenever Combobox clears the input itself: a pick or create under multiple, a free-text commit (including one of a value that is already selected, which fires no change) and clear(). Pair it with disableFilter to drive async / server-side filtering: refetch options from the query and the popup re-renders the supplied list verbatim. query() on the handle reads the current text.
change Fired when the selected value changes — a user picks an option (toggling membership in multiple mode), commits free text (delimiters / validate / splitPaste / commitOnBlur), or clear() resets it. Payload { value, option, selected, text? } (ComboboxChangePayload); text is set ONLY on free-text commits, where option is null; it is the stored string (what validate returned, when it returned one). value is always the model's NEW value — the whole array in multiple mode, the scalar (or null) in single mode. option is the raw source option that was just toggled (null after a clear()). selected names the direction of the toggle: true when the option was just added (and always true in single-select), false when it was just removed or after clear().
create Fired when creatable is set and the user commits text matching no option (case-insensitive, trimmed, exact label equality — no Unicode normalization). Payload { query } — the committed text. Combobox writes NOTHING to value when this fires — the consumer is responsible for adding the option to options and updating the model itself. Fires at most once per distinct query (a double-commit of the same text is a no-op); composes with multiple (value stays untouched there too).

Imperative handle

Beyond props, the component exposes imperative methods (declared once in the Rozie source via $expose). Grab a handle with the native ref mechanism and call them directly. Note: focus() deliberately overrides the inherited HTMLElement.focus (it focuses the text input) — on the Lit custom element this is an accepted ROZ137 warn-only override, the public focus() handle is intended:

Method Description
focus Move DOM focus to the text input. NOTE: this deliberately overrides the inherited HTMLElement.focus on the Lit custom element (ROZ137 warns, warn-only) — the public focus() handle is intended.
clear Reset the selection: clear value (emits change with { value: null } in single-select mode, { value: [] } under multiple) and empty the input text (emits search with { query: '' } when there was text).
seedQuery Imperative-only: set the input text (text ?? '', coerced to a string) without touching the value model or selection state — the typed query AND the filtered option list reflect it. Does not open the popup or emit change/search.
pinOpen Imperative-only: pin (or unpin) the popup open, coercing its argument to a boolean. While pinned, onBlur() early-returns so the popup does NOT collapse when a host sub-surface (e.g. an action flyout) moves DOM focus out of the input. pinOpen(false) only unpins — it does not itself close the popup or restore focus (the host does that). Render-neutral when never called.
activeOption Return the currently highlighted RAW source option (the object from options), or null when nothing is highlighted, the popup is hidden, or the highlighted row is a synthetic "+N more" / create row. Read-only — use it e.g. to preview the option Enter or Tab (selectOnTab) would pick.
query Return the current input text — the value the last search event reported. Read-only; use seedQuery(text) to set it.
<script setup>
import { ref } from 'vue';
const cb = ref();          // template ref
</script>

<template>
  <Combobox ref="cb" v-model:value="value" :options="frameworks" />
  <button @click="cb.clear()">Clear</button>
</template>

Slots

Slot Params
chip option, remove, index
option option, index, active, selected, disabled
empty query
create query
groupHeading group
groupMore group, hidden, expand

Related Packages

@trevoreyre/autocomplete

Simple autocomplete component in vanilla JS and Vue

62,090 437
@trevoreyre/autocomplete-vue

Simple autocomplete component in vanilla JS and Vue

388,169 437
@trevoreyre/autocomplete-js

Simple autocomplete component in vanilla JS and Vue

224,366 437
@rozie-ui/toast-vue

Idiomatic Vue headless, accessible toast / notification host (queue, auto-dismis...

1,675 1
@rozie-ui/date-picker-vue

Idiomatic Vue headless WAI-ARIA single-date calendar (month grid, prev/next nav,...

1,608 1

Version History

Version Released Vue License
0.8.1 ^3.4 MIT
0.8.0 ^3.4 MIT
0.7.0 ^3.4 MIT
0.6.0 ^3.4 MIT
0.5.1 ^3.4 MIT