Skip to main content

Starwind UI v3.7 is here with stable Vue and Svelte, the new Chart component, and full RTL support. Read the release notes

Combobox Primitive

Use Combobox when someone needs to type to find an option. It opens a list beside the input and lets the person choose a match with the keyboard.

Framework

Anatomy

Use the Astro primitive adapter to render Combobox anatomy with the Runtime wiring included.

---
import { Combobox } from "@starwind-ui/astro/combobox";
---
<Combobox.Root>
<Combobox.Label>Choose a framework</Combobox.Label>
<Combobox.InputGroup>
<Combobox.Input placeholder="Search frameworks" />
<Combobox.Trigger>Open</Combobox.Trigger>
<Combobox.Clear>Clear</Combobox.Clear>
</Combobox.InputGroup>
<Combobox.Positioner>
<Combobox.Popup>
<Combobox.Empty>No results</Combobox.Empty>
<Combobox.List>
<Combobox.Item value="astro">
<Combobox.ItemText>Astro</Combobox.ItemText>
<Combobox.ItemIndicator />
</Combobox.Item>
<Combobox.Item value="react">
<Combobox.ItemText>React</Combobox.ItemText>
<Combobox.ItemIndicator />
</Combobox.Item>
</Combobox.List>
</Combobox.Popup>
</Combobox.Positioner>
</Combobox.Root>

Astro, React, Vue, and Svelte components use the same underlying interactions. Each framework has its own way to read and update state. See the examples and your installed packageโ€™s types for the available props and events. Plain HTML uses DOM events and Runtime methods.

Floating Behavior

FactValue
Anchor partinputGroup
Positioner partpositioner
Popup partpopup
Portal partportal
Option propsside, align, sideOffset, alignOffset, avoidCollisions

API Reference

Root

The main element that owns the Combobox Runtime instance.

Default element
div
Discovery hook
data-sw-combobox
Role
-

Props

Prop Type Default Toggle
open boolean -
Description
Controls whether Combobox is open.
Kind
control
Targets
-
Full type
boolean
React

Use open for controlled state and defaultOpen for default state, and onOpenChange for change proposals.

  • open
  • defaultOpen
  • onOpenChange
Astro

Use open or defaultOpen for initial state, listen for starwind:open-change, and call setOpen for later updates.

  • open
  • defaultOpen
  • starwind:open-change
  • setOpen
Runtime / HTML

Use data-default-open for initial state, listen for starwind:open-change, and call setOpen for later updates.

  • data-default-open
  • starwind:open-change
  • setOpen
defaultOpen boolean -
Description
Sets whether Combobox starts open.
Kind
control
Targets
-
Full type
boolean
React

Use open for controlled state and defaultOpen for default state, and onOpenChange for change proposals.

  • open
  • defaultOpen
  • onOpenChange
Astro

Use open or defaultOpen for initial state, listen for starwind:open-change, and call setOpen for later updates.

  • open
  • defaultOpen
  • starwind:open-change
  • setOpen
Runtime / HTML

Use data-default-open for initial state, listen for starwind:open-change, and call setOpen for later updates.

  • data-default-open
  • starwind:open-change
  • setOpen
value string | null -
Description
Controls the current Combobox value.
Kind
control
Targets
-
Full type
string | null
React

Use value for controlled state and defaultValue for default state, and onValueChange for change proposals.

  • value
  • defaultValue
  • onValueChange
Astro

Use value or defaultValue for initial state, listen for starwind:value-change, and call setValue for later updates.

  • value
  • defaultValue
  • starwind:value-change
  • setValue
Runtime / HTML

Use data-default-value for initial state, listen for starwind:value-change, and call setValue for later updates.

  • data-default-value
  • starwind:value-change
  • setValue
defaultValue string | null -
Description
Sets the initial Combobox value for uncontrolled usage.
Kind
control
Targets
-
Full type
string | null
React

Use value for controlled state and defaultValue for default state, and onValueChange for change proposals.

  • value
  • defaultValue
  • onValueChange
Astro

Use value or defaultValue for initial state, listen for starwind:value-change, and call setValue for later updates.

  • value
  • defaultValue
  • starwind:value-change
  • setValue
Runtime / HTML

Use data-default-value for initial state, listen for starwind:value-change, and call setValue for later updates.

  • data-default-value
  • starwind:value-change
  • setValue
inputValue string -
Description
Controls the input value for Combobox.
Kind
control
Targets
-
Full type
string
React

Use inputValue for controlled state and defaultInputValue for default state, and onInputValueChange for change proposals.

  • inputValue
  • defaultInputValue
  • onInputValueChange
Astro

Use inputValue or defaultInputValue for initial state, listen for starwind:input-value-change, and call setInputValue for later updates.

  • inputValue
  • defaultInputValue
  • starwind:input-value-change
  • setInputValue
Runtime / HTML

Use data-default-input-value for initial state, listen for starwind:input-value-change, and call setInputValue for later updates.

  • data-default-input-value
  • starwind:input-value-change
  • setInputValue
defaultInputValue string -
Description
Controls the default input value for Combobox.
Kind
control
Targets
-
Full type
string
React

Use inputValue for controlled state and defaultInputValue for default state, and onInputValueChange for change proposals.

  • inputValue
  • defaultInputValue
  • onInputValueChange
Astro

Use inputValue or defaultInputValue for initial state, listen for starwind:input-value-change, and call setInputValue for later updates.

  • inputValue
  • defaultInputValue
  • starwind:input-value-change
  • setInputValue
Runtime / HTML

Use data-default-input-value for initial state, listen for starwind:input-value-change, and call setInputValue for later updates.

  • data-default-input-value
  • starwind:input-value-change
  • setInputValue
autoComplete string -
Description
Sets the native autocomplete behavior.
Kind
option
Targets
-
Full type
string
disabled boolean -
Description
Disables the Root part.
Kind
option
Targets
-
Full type
boolean
filterMode "contains" | "startsWith" "contains"
Description
Configures the filter mode option for the Root part.
Kind
option
Targets
-
Full type
"contains" | "startsWith"
form string -
Description
Associates the control with a form element.
Kind
option
Targets
-
Full type
string
highlightItemOnHover boolean true
Description
Highlights Combobox items when the pointer moves over them.
Kind
option
Targets
-
Full type
boolean
locale string -
Description
Sets the locale used by Combobox.
Kind
option
Targets
-
Full type
string
modal boolean false
Description
Makes Combobox behave as a modal overlay.
Kind
option
Targets
-
Full type
boolean
name string -
Description
Sets the submitted form field name.
Kind
option
Targets
-
Full type
string
readOnly boolean false
Description
Marks the control as read-only.
Kind
option
Targets
-
Full type
boolean
required boolean -
Description
Marks the form control as required.
Kind
option
Targets
-
Full type
boolean
onInputValueChange (inputValue: string, details: ComboboxInputValueChangeDetails) => void -
Description
Runs when on input value change changes for Combobox.
Kind
callback
Targets
-
Full type
(inputValue: string, details: ComboboxInputValueChangeDetails) => void
React

Use inputValue for controlled state and defaultInputValue for default state, and onInputValueChange for change proposals.

  • inputValue
  • defaultInputValue
  • onInputValueChange
Astro

Use inputValue or defaultInputValue for initial state, listen for starwind:input-value-change, and call setInputValue for later updates.

  • inputValue
  • defaultInputValue
  • starwind:input-value-change
  • setInputValue
Runtime / HTML

Use data-default-input-value for initial state, listen for starwind:input-value-change, and call setInputValue for later updates.

  • data-default-input-value
  • starwind:input-value-change
  • setInputValue
onOpenChange (open: boolean, details: ComboboxOpenChangeDetails) => void -
Description
Runs when Combobox opens or closes.
Kind
callback
Targets
-
Full type
(open: boolean, details: ComboboxOpenChangeDetails) => void
React

Use open for controlled state and defaultOpen for default state, and onOpenChange for change proposals.

  • open
  • defaultOpen
  • onOpenChange
Astro

Use open or defaultOpen for initial state, listen for starwind:open-change, and call setOpen for later updates.

  • open
  • defaultOpen
  • starwind:open-change
  • setOpen
Runtime / HTML

Use data-default-open for initial state, listen for starwind:open-change, and call setOpen for later updates.

  • data-default-open
  • starwind:open-change
  • setOpen
onValueChange (value: string | null, details: ComboboxValueChangeDetails) => void -
Description
Runs when the Combobox value changes.
Kind
callback
Targets
-
Full type
(value: string | null, details: ComboboxValueChangeDetails) => void
React

Use value for controlled state and defaultValue for default state, and onValueChange for change proposals.

  • value
  • defaultValue
  • onValueChange
Astro

Use value or defaultValue for initial state, listen for starwind:value-change, and call setValue for later updates.

  • value
  • defaultValue
  • starwind:value-change
  • setValue
Runtime / HTML

Use data-default-value for initial state, listen for starwind:value-change, and call setValue for later updates.

  • data-default-value
  • starwind:value-change
  • setValue

Events

Event Callback Value Toggle
inputValueChange onInputValueChange inputValue: string
Description
Fires when the text input value changes for Combobox.
DOM event
starwind:input-value-change
Details type
ComboboxInputValueChangeDetails
Timing
before-state-commit
Cancelable
Yes
Cancellation sequence
  1. Check internal eligibility and intent.
  2. Create one details object for the proposal.
  3. Call the Runtime callback with the details object when the controller exposes one.
  4. Dispatch the cancelable DOM event with the same details object, including when the callback canceled it.
  5. Read details.isCanceled, including cancellation caused by preventDefault().
  6. Apply the accepted state.
  7. Notify Runtime subscribers and other accepted-only observers.
openChange onOpenChange open: boolean
Description
Fires when Combobox opens or closes.
DOM event
starwind:open-change
Details type
ComboboxOpenChangeDetails
Timing
before-state-commit
Cancelable
Yes
Cancellation sequence
  1. Check internal eligibility and intent.
  2. Create one details object for the proposal.
  3. Call the Runtime callback with the details object when the controller exposes one.
  4. Dispatch the cancelable DOM event with the same details object, including when the callback canceled it.
  5. Read details.isCanceled, including cancellation caused by preventDefault().
  6. Apply the accepted state.
  7. Notify Runtime subscribers and other accepted-only observers.
valueChange onValueChange value: string | null
Description
Fires when the value changes for Combobox.
DOM event
starwind:value-change
Details type
ComboboxValueChangeDetails
Timing
before-state-commit
Cancelable
Yes
Cancellation sequence
  1. Check internal eligibility and intent.
  2. Create one details object for the proposal.
  3. Call the Runtime callback with the details object when the controller exposes one.
  4. Dispatch the cancelable DOM event with the same details object, including when the callback canceled it.
  5. Read details.isCanceled, including cancellation caused by preventDefault().
  6. Apply the accepted state.
  7. Notify Runtime subscribers and other accepted-only observers.

State

State Type Props Toggle
inputValue string inputValue / defaultInputValue
Description
Tracks the current text input value for Combobox.
Initial attribute
data-default-input-value
Runtime getter
getInputValue
Runtime setter
setInputValue
React

Use inputValue for controlled state and defaultInputValue for default state, and onInputValueChange for change proposals.

  • inputValue
  • defaultInputValue
  • onInputValueChange
Astro

Use inputValue or defaultInputValue for initial state, listen for starwind:input-value-change, and call setInputValue for later updates.

  • inputValue
  • defaultInputValue
  • starwind:input-value-change
  • setInputValue
Runtime / HTML

Use data-default-input-value for initial state, listen for starwind:input-value-change, and call setInputValue for later updates.

  • data-default-input-value
  • starwind:input-value-change
  • setInputValue
open boolean open / defaultOpen
Description
Tracks whether Combobox is open.
Initial attribute
data-default-open
Runtime getter
getOpen
Runtime setter
setOpen
React

Use open for controlled state and defaultOpen for default state, and onOpenChange for change proposals.

  • open
  • defaultOpen
  • onOpenChange
Astro

Use open or defaultOpen for initial state, listen for starwind:open-change, and call setOpen for later updates.

  • open
  • defaultOpen
  • starwind:open-change
  • setOpen
Runtime / HTML

Use data-default-open for initial state, listen for starwind:open-change, and call setOpen for later updates.

  • data-default-open
  • starwind:open-change
  • setOpen
value string | null value / defaultValue
Description
Tracks the current Combobox value.
Initial attribute
data-default-value
Runtime getter
getValue
Runtime setter
setValue
React

Use value for controlled state and defaultValue for default state, and onValueChange for change proposals.

  • value
  • defaultValue
  • onValueChange
Astro

Use value or defaultValue for initial state, listen for starwind:value-change, and call setValue for later updates.

  • value
  • defaultValue
  • starwind:value-change
  • setValue
Runtime / HTML

Use data-default-value for initial state, listen for starwind:value-change, and call setValue for later updates.

  • data-default-value
  • starwind:value-change
  • setValue

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox - Marks the Root part so Starwind Runtime can find it.
State
Attribute Value Description
data-state - Reflects the current state on the Root part.
data-input-value - Reflects the input value state on the Root part.
Metadata
Attribute Value Description
data-autocomplete - Reflects the autocomplete prop on the Root part.
data-default-input-value - Reflects the default input value prop on the Root part.
data-default-open - Reflects the default open prop on the Root part.
data-default-value - Reflects the default value prop on the Root part.
data-disabled - Reflects the disabled prop on the Root part.
data-filter-mode - Reflects the filter mode prop on the Root part.
data-form - Reflects the form prop on the Root part.
data-highlight-item-on-hover - Reflects the highlight item on hover prop on the Root part.
data-locale - Reflects the locale prop on the Root part.
data-modal - Reflects the modal prop on the Root part.
data-name - Reflects the name prop on the Root part.
data-readonly - Reflects the readonly prop on the Root part.
data-required - Reflects the required prop on the Root part.

Label

Text label associated with Combobox.

Default element
div
Discovery hook
data-sw-combobox-label
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-label - Marks the Label part so Starwind Runtime can find it.

Input Group

Groups the input controls for Combobox.

Default element
div
Discovery hook
data-sw-combobox-input-group
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-input-group - Marks the Input Group part so Starwind Runtime can find it.

Input

The native input synchronized by Combobox.

Default element
input
Discovery hook
data-sw-combobox-input
Role
combobox

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-input - Marks the Input part so Starwind Runtime can find it.

Trigger

The control that opens, closes, or targets the Combobox content.

Default element
button
Discovery hook
data-sw-combobox-trigger
Role
-

Props

Prop Type Default Toggle
asChild boolean -
Description
Merges behavior onto your child element instead of rendering the default Trigger element.
Kind
rendering
Targets
clear, trigger
Full type
boolean

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-trigger - Marks the Trigger part so Starwind Runtime can find it.
State
Attribute Value Description
data-state - Reflects the current state on the Trigger part.

Icon

Decorative icon rendered by Combobox.

Default element
span
Discovery hook
data-sw-combobox-icon
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-icon - Marks the Icon part so Starwind Runtime can find it.

Clear

Clears the current Combobox value.

Default element
button
Discovery hook
data-sw-combobox-clear
Role
-

Props

Prop Type Default Toggle
asChild boolean -
Description
Merges behavior onto your child element instead of rendering the default Clear element.
Kind
rendering
Targets
clear, trigger
Full type
boolean

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-clear - Marks the Clear part so Starwind Runtime can find it.

Value

Displays the current Combobox value.

Default element
span
Discovery hook
data-sw-combobox-value
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-value - Marks the Value part so Starwind Runtime can find it.

Hidden Input

The hidden native input synchronized by Combobox.

Default element
input
Discovery hook
data-sw-combobox-hidden-input
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-hidden-input - Marks the Hidden Input part so Starwind Runtime can find it.

Portal

Moves Combobox overlay content to the document body when needed.

Default element
div
Discovery hook
data-sw-combobox-portal
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-portal - Marks the Portal part so Starwind Runtime can find it.
data-placement - Marks the Portal part so Starwind Runtime can find it.
Metadata
Attribute Value Description
data-container - Reflects the container prop on the Portal part.
data-disabled - Reflects the disabled prop on the Portal part.
data-sw-portal-placement runtime Identifies Portal metadata for styling and selectors.

Positioner

Positions the Combobox content relative to its trigger.

Default element
div
Discovery hook
data-sw-combobox-positioner
Role
-

Props

Prop Type Default Toggle
side "top" | "right" | "bottom" | "left" "bottom"
Description
Sets the preferred side for Combobox content.
Kind
option
Targets
positioner, popup
Full type
"top" | "right" | "bottom" | "left"
align "start" | "center" | "end" "start"
Description
Sets how Combobox content aligns to its trigger.
Kind
option
Targets
positioner, popup
Full type
"start" | "center" | "end"
sideOffset number 4
Description
Sets the distance between Combobox content and its trigger.
Kind
option
Targets
positioner, popup
Full type
number
alignOffset number 0
Description
Adjusts the cross-axis alignment offset for Combobox content.
Kind
option
Targets
positioner, popup
Full type
number
avoidCollisions boolean true
Description
Allows Combobox content to shift or flip to stay visible.
Kind
option
Targets
positioner, popup
Full type
boolean

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-positioner - Marks the Positioner part so Starwind Runtime can find it.
Metadata
Attribute Value Description
data-side - Reflects the side prop on the Positioner part.
data-align - Reflects the align prop on the Positioner part.
data-side-offset - Reflects the side offset prop on the Positioner part.
data-align-offset - Reflects the align offset prop on the Positioner part.
data-avoid-collisions - Reflects the avoid collisions prop on the Positioner part.

The floating content container for Combobox.

Default element
div
Discovery hook
data-sw-combobox-popup
Role
listbox

Props

Prop Type Default Toggle
side "top" | "right" | "bottom" | "left" "bottom"
Description
Sets the preferred side for Combobox content.
Kind
option
Targets
positioner, popup
Full type
"top" | "right" | "bottom" | "left"
align "start" | "center" | "end" "start"
Description
Sets how Combobox content aligns to its trigger.
Kind
option
Targets
positioner, popup
Full type
"start" | "center" | "end"
sideOffset number 4
Description
Sets the distance between Combobox content and its trigger.
Kind
option
Targets
positioner, popup
Full type
number
alignOffset number 0
Description
Adjusts the cross-axis alignment offset for Combobox content.
Kind
option
Targets
positioner, popup
Full type
number
avoidCollisions boolean true
Description
Allows Combobox content to shift or flip to stay visible.
Kind
option
Targets
positioner, popup
Full type
boolean

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-popup - Marks the Popup part so Starwind Runtime can find it.
State
Attribute Value Description
data-state - Reflects the current state on the Popup part.
Metadata
Attribute Value Description
data-side - Reflects the side prop on the Popup part.
data-align - Reflects the align prop on the Popup part.
data-side-offset - Reflects the side offset prop on the Popup part.
data-align-offset - Reflects the align offset prop on the Popup part.
data-avoid-collisions - Reflects the avoid collisions prop on the Popup part.

Empty

Content shown when Combobox has no matching items.

Default element
div
Discovery hook
data-sw-combobox-empty
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-empty - Marks the Empty part so Starwind Runtime can find it.

List

The list of selectable Combobox items.

Default element
div
Discovery hook
data-sw-combobox-list
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-list - Marks the List part so Starwind Runtime can find it.

Group

Groups related Combobox items.

Default element
div
Discovery hook
data-sw-combobox-group
Role
group

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-group - Marks the Group part so Starwind Runtime can find it.

Group Label

Labels a group of Combobox items.

Default element
div
Discovery hook
data-sw-combobox-group-label
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-group-label - Marks the Group Label part so Starwind Runtime can find it.

Item

An interactive item inside the Combobox collection.

Default element
div
Discovery hook
data-sw-combobox-item
Role
option

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-item - Marks the Item part so Starwind Runtime can find it.
Metadata
Attribute Value Description
data-value - Reflects the value prop on the Item part.
data-disabled - Reflects the disabled prop on the Item part.

Item Text

Text content for a Combobox item.

Default element
span
Discovery hook
data-sw-combobox-item-text
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-item-text - Marks the Item Text part so Starwind Runtime can find it.

Item Indicator

Shows the selected state for a Combobox item.

Default element
span
Discovery hook
data-sw-combobox-item-indicator
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-item-indicator - Marks the Item Indicator part so Starwind Runtime can find it.
State
Attribute Value Description
data-state - Reflects the current state on the Item Indicator part.
data-hidden - Reflects the hidden state on the Item Indicator part.

Separator

Separates groups of Combobox items.

Default element
div
Discovery hook
data-sw-combobox-separator
Role
separator

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-combobox-separator - Marks the Separator part so Starwind Runtime can find it.

Runtime API

Factory
createCombobox
Import
@starwind-ui/runtime/combobox
Root hook
root data-sw-combobox
Option props
autoComplete, defaultInputValue, defaultOpen, defaultValue, disabled, filterMode, form, highlightItemOnHover, inputValue, locale, modal, name, open, readOnly, required, value

Option Lifecycles

OptionLifecycle
autoCompletesetter-backed
defaultInputValueconstructor-only
defaultOpenconstructor-only
defaultValueconstructor-only
disabledsetter-backed
filterModeconstructor-only
formsetter-backed
highlightItemOnHoverconstructor-only
inputValuesetter-backed
localeconstructor-only
modalconstructor-only
namesetter-backed
opensetter-backed
readOnlyconstructor-only
requiredsetter-backed
valuesetter-backed

Runtime Setters

Method Target Description
setDisabled prop: disabled Updates whether Combobox is disabled from Runtime code.
setInputValue state: inputValue Updates the Combobox text input value from Runtime code.
setOpen state: open Opens or closes Combobox from Runtime code.
setValue state: value Updates the current Combobox value from Runtime code.

Form Participation

FactValue
Form propsautoComplete, form, name, required, value
Hidden inputhiddenInput (text)
Field integrationYes
Component Relationship
Combobox Direct primitive

Changelog

View version history v1.3.0 10 releases

v1.3.0

  • Combobox popups keep the direction of the input when they move into a portal, including inside a section with the opposite `dir`.
  • When you close the list with Escape or by choosing an item, Combobox now returns focus to the input without scrolling the page. Before, in Safari, the page could jump back to the input after you scrolled.
  • A click during the Combobox popup close animation now goes to the page below the popup. Before, the closing popup caught the click, so a quick click on a control under it did nothing.
  • In Vue, Combobox now shows the item label in the input when the parent sets a value after the first render, with `v-model` or a one-way `value` prop. Before, the input stayed empty.
  • In Vue, this Primitive now uses the same `asChild` child handling as the other Vue Primitives. Its public API is unchanged. An invalid `asChild` child now gives one shorter error message.
  • In Vue, `ComboboxContextValue` no longer has `element`, `mounted` or `registerPortal()`. The state fields, such as `open` and `value`, stay.
  • Combobox now closes when you press Tab right after the click that opened it. Before, focus left the list, but it stayed open.
  • In Svelte, the server HTML of `Combobox.Trigger` now prints `data-state`, and a disabled Trigger or Clear prints `aria-disabled`, as in the other frameworks.
  • In Svelte, `data-default-value` and `data-default-input-value` now come only from the `defaultValue` and `defaultInputValue` props.
  • In Vue, this component now needs Vue 3.5.21 or newer.
  • Internal code cleanup, such as unused code and import order. This cleanup does not change behavior.

v1.2.0

  • Combobox now closes when focus leaves it. Before, the list stayed open after you pressed Tab or Shift+Tab. The list stays open while focus moves between the input, the trigger, and the clear button. The close uses the new `focus-out` reason. Call `cancel()` in `onOpenChange` to keep the list open.
  • Combobox now sends its events in the same order in every framework. Pressing an item sends the value change, then the input text change with the `item-press` reason, then the open change. Clearing sends the value change, then the input text change to `""` with the `clear` reason. You can cancel the input text change in every framework.
  • When you cancel a typed change, the input text goes back to the previous text. This now also works in Astro.
  • When your code controls `value` and keeps it without calling `cancel()`, the input text now shows the label of the value you kept. When your code controls `inputValue`, typing in the middle of the text keeps the caret in place. A form reset keeps a value that your code controls.
  • Fixed a Combobox with a `ComboboxTrigger` that you added yourself. Before, only the trigger inside the input rendered by `ComboboxInput` worked. Now every trigger opens and closes the list and shows the open and disabled state.
  • Focus now goes back to a trigger after a close only when you have not moved on. Before, this could close a Combobox that you had just opened.
  • Styled `ComboboxClear` with `asChild` now uses your child as the button. Before, the default icon made a button inside a button in Vue and React, and a hydration mismatch in Nuxt. Add your own icon to the child if you want one.
  • In React, Combobox now opens on the first focus of its input, as it does in Astro, Vue, and Svelte, and it keeps `data-value` on the root when a parent changes the value while the list is closed.
  • Fixed a Combobox with more than one `ComboboxClear`. Before, only the first one worked. Pressing another one did not clear the selection or the text, and inside the input group it opened the list. Now every `ComboboxClear` clears the selection and the text, and each one shows the disabled state.
  • In Svelte, a Combobox that gets its props through a spread, such as `{...props}`, now shows the new label when your state changes `value`. Before, the text field kept the old label while the form sent the new value.
  • In Svelte, `Combobox.Root` now renders option attributes such as `data-modal` and `data-filter-mode`, and its first render shows the open state.
  • In Svelte, the Primitive `Combobox.Clear` no longer adds an English `aria-label`. Set your own label.
  • In React, Combobox now shows the selected label when your own component renders the items. If your items load later, a value has no label until someone opens the list and picks an item.
  • If you use Runtime directly and your items render only when the list opens, pass the new `resolveValueText` option to `createCombobox`. It returns the label for a selected value whose item is not rendered.
  • In Astro, an attribute that you set on a Combobox part now wins over the part's own default for the same attribute, such as `role` or `aria-label`.
  • In Svelte, a defined `value`, `inputValue`, or `open` that you pass when Combobox mounts now stays under your control, as in React and Vue. To change it, use `bind:` or update your state in the change callback. A form reset keeps it. If you pass `undefined` at mount, Combobox keeps its own state.
  • In Svelte, `Combobox.Trigger` and `Combobox.Clear` still need a button in `child`. With another element they do nothing, and they now log a console error in production as well as in development.
  • In Vue, the template ref of the Combobox root no longer has the undocumented methods `open`, `close`, `updatePosition`, `getValue`, and `setValue`. It exposes only `element`. Use `v-model` on the root instead.
  • In React, Select and Combobox inside a `Field` with a `name` now send their value when the form submits, and they call `onValueChange`, `onOpenChange`, and `onInputValueChange`. Before, the form often left the value out, and the callbacks did not run.

v1.1.3

  • A `required` Combobox now stops a plain HTML form from submitting when no option is selected. The browser shows its message and puts focus in the Combobox input. The list stays closed so it does not cover the message. Before, the empty form submitted, and no message showed.
  • A Combobox without `required` still lets the Enter key submit the form as before.

v1.1.2

  • Fixed form resets overwriting newer input or changing the value after a reset was canceled. React restores input text after Escape, and Vue restores it after a canceled input change.
  • Reduced background work when a React page uses multiple menus, tooltips, or other portals.
  • Fixed nested Svelte overlays inside a dialog appearing behind their parent or failing to receive clicks.
  • Reduced background work when a Vue page uses multiple menus, tooltips, or other portals.
  • Fixed nested overlays appearing behind their parent in Vue and Svelte. Overlays can now render under the document body; if custom CSS or DOM queries require them to stay inside a parent, set a portal container or add `data-floating-root` to that parent.
  • Reduced the JavaScript loaded by Combobox when it is used without Field.
  • Fixed React 18 retaining removed popup elements when the parent component stays mounted.
  • Reduced repeated JavaScript when Astro Combobox is used with other Starwind components.
  • Reduced JavaScript used by Svelte Combobox. Element props, event handlers, and refs keep the same behavior.

v1.1.1

  • Group headings are now linked to their groups with `aria-labelledby`, so screen readers announce the name of each group.

v1.1.0

  • Added `container` and `disabled` to the Portal part. `container` sets the element that holds the popup, and `disabled` keeps the popup in place. Portals now place nested popups in the same way every time, and they show their placement in data attributes.

v1.0.0

  • This Primitive is now stable at version `1.0.0`. Its API and behavior stay the same as in the previous release.

v0.1.2

  • The React Primitive files that the CLI copies into your project are now marked with `"use client"`, so they stay client components in React server frameworks.
  • In React, you can cancel a change from its change callback or DOM event before it applies. React then shows only the changes that apply.
  • In React, you can now cancel the value and input text changes that Combobox commands make.

v0.1.1

  • When `modal` is set, the page behind the Combobox no longer scrolls while the list is open.

v0.1.0

  • First release. Combobox filters and selects items and supports keyboard navigation. It places its list next to the input and sends its value with the form.