An input combined with a list of predefined items to select.
Usage guidelines
- Combobox is a filterable Select: Use Combobox when the input is restricted to a set of predefined items, like Select, but whose items can be filtered by typing. Prefer it over Select when there are enough items to warrant filtering.
- Avoid for simple search widgets: Combobox doesn't allow free-form text. For search widgets, consider Autocomplete.
- Avoid when not rendering an input: Use Select instead if no input is rendered: it includes accessibility features specific to a listbox without an input.
- Form controls must have an accessible name: If
ComboboxInputis the form control, label it with a native<label>orFieldLabel, or give it anaria-labelwhen no visible label is rendered.ComboboxLabellabelsComboboxTrigger, for the pattern where the input is inside the popup and the trigger is the form control. - Closing animations: The popup stays rendered until its closing animation finishes. See Animation.
Anatomy
Import the primitives and assemble the parts:
@using Blazix.Primitives
<ComboboxRoot>
<ComboboxLabel />
<ComboboxInputGroup>
<ComboboxInput />
<ComboboxTrigger />
<ComboboxIcon />
<ComboboxClear />
<ComboboxValue />
<ComboboxChips>
<ComboboxChip>
<ComboboxChipRemove />
</ComboboxChip>
</ComboboxChips>
</ComboboxInputGroup>
<ComboboxPortal>
<ComboboxBackdrop />
<ComboboxPositioner>
<ComboboxPopup>
<ComboboxArrow />
<ComboboxStatus />
<ComboboxEmpty />
<ComboboxList>
<ComboboxRow>
<ComboboxItem>
<ComboboxItemIndicator />
</ComboboxItem>
</ComboboxRow>
<ComboboxSeparator />
<ComboboxGroup>
<ComboboxGroupLabel />
</ComboboxGroup>
<ComboboxCollection />
</ComboboxList>
</ComboboxPopup>
</ComboboxPositioner>
</ComboboxPortal>
</ComboboxRoot>API Reference
ComboboxRoot
Doesn't render its own HTML element.
ComboboxTrigger
Renders a <button> element.
Other attributes are passed to the element it renders.
ComboboxValue
Renders a <span> element.
Other attributes are passed to the element it renders.
ComboboxInput
Renders a <input> element.
Other attributes are passed to the element it renders.
ComboboxIcon
Renders a <span> element.
Other attributes are passed to the element it renders.
ComboboxClear
Renders a <button> element.
Other attributes are passed to the element it renders.
ComboboxList
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxPortal
Doesn't render its own HTML element.
ComboboxBackdrop
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxPositioner
Doesn't render its own HTML element.
ComboboxPopup
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxArrow
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxItem
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxGroup
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxGroupLabel
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxSeparator
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxLabel
Renders a <label> element.
Other attributes are passed to the element it renders.
ComboboxStatus
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxEmpty
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxCollection
Doesn't render its own HTML element.
ComboboxRow
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxChips
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxChip
Renders a <div> element.
Other attributes are passed to the element it renders.
ComboboxChipRemove
Renders a <button> element.
Other attributes are passed to the element it renders.
ComboboxItemIndicator
Renders a <span> element.
Other attributes are passed to the element it renders.
ComboboxInputGroup
Renders a <div> element.
Other attributes are passed to the element it renders.