Skip to content
Nana UI

Combobox

View .md Download

An editable text field paired with a filterable listbox. Type to filter the nana-option children, then pick a value with the keyboard or pointer. The panel flips above the field when it would overflow the viewport.

Apple Banana
Terminal window
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/combobox";
<nana-combobox label="Fruit" placeholder="Search…" style="min-width:16rem">
<nana-option value="apple">Apple</nana-option>
<nana-option value="banana">Banana</nana-option>
</nana-combobox>

Slot an icon into the prefix slot; clearable adds a reset button.

United States Canada Mexico

Properties

PropertyAttributeTypeDefaultDescription
clearablebooleanfalse
disabledbooleanfalse
errorMessageerror-messagestring''
helperTexthelper-textstring''
inputId`nana-combobox-${Math.random().toString(36).slice(2, 7)}`
invalidbooleanfalse
labelstring''
namestring''
openbooleanfalse
placeholderstring''
readonlybooleanfalse
requiredbooleanfalse
sizeComboboxSize'md'
valuestring''Selected option value (the form value)

Events

EventDescription
nana-inputFired while typing (`detail.value` — the query text)
nana-changeFired when an option is selected (`detail.value`)
nana-clearFired when the field is cleared
nana-focusFired on focus
nana-blurFired on blur

Slots

SlotDescription
(default)`nana-option` children
prefixLeading icon inside the field

CSS parts

PartDescription
::part(wrapper)The bordered field container
::part(input)The native `<input>` element
::part(panel)The floating listbox panel

CSS custom properties

PropertyDescription
--nana-combobox-max-heightPanel max height before scrolling
EventTypeDescription
nana-inputCustomEventFired while typing (detail.value — the query text)
nana-changeCustomEventFired when an option is selected (detail.value)
nana-clearCustomEventFired when the field is cleared
nana-focusCustomEventFired on focus
nana-blurCustomEventFired on blur
SlotDescription
(default)nana-option children
prefixLeading icon inside the field
VariableDefaultDescription
--nana-combobox-max-heightPanel max height before scrolling
PartDescription
wrapperThe bordered field container
inputThe native <input> element
panelThe floating listbox panel
  • Keyboard accessible
  • Screen-reader labels
  • Focus-visible states
  • ARIA roles and states
  • WCAG 2.2 AA contrast
Explore Combobox interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook