Combobox
Input with a filterable list of options and optional multiple selection.
Installation
import { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue } from "@xerobi/ui/combobox"This component is client-side. In Astro, hydrate it with a client directive.
Examples
Default
import { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList } from "@xerobi/ui/combobox"
export function ComboboxDefault() {
const issues = ["Bug", "Feature", "Documentation", "Question"]
return (
<Combobox items={issues}>
<ComboboxInput className="w-64" placeholder="Select an issue" aria-label="Issue type" />
<ComboboxContent>
<ComboboxEmpty>No issues found.</ComboboxEmpty>
<ComboboxList>{(item: string) => <ComboboxItem key={item} value={item}>{item}</ComboboxItem>}</ComboboxList>
</ComboboxContent>
</Combobox>
)
}API reference
Combobox
No props of its own.
ComboboxChip
| Prop | Type | Description |
|---|---|---|
| showRemove | boolean |
ComboboxChips
No props of its own.
ComboboxChipsInput
No props of its own.
ComboboxCollection
No props of its own.
ComboboxContent
No props of its own.
ComboboxEmpty
No props of its own.
ComboboxGroup
No props of its own.
ComboboxInput
| Prop | Type | Description |
|---|---|---|
| showTrigger | boolean | |
| showClear | boolean |
ComboboxItem
No props of its own.
ComboboxLabel
No props of its own.
ComboboxList
No props of its own.
ComboboxSeparator
No props of its own.
ComboboxTrigger
No props of its own.
ComboboxValue
No props of its own.
Styling hooks: [data-slot="combobox-value"], [data-slot="combobox-trigger"], [data-slot="combobox-clear"], [data-slot="input-group-button"], [data-slot="combobox-content"], [data-slot="combobox-list"], [data-slot="combobox-item"], [data-slot="combobox-group"], [data-slot="combobox-label"], [data-slot="combobox-collection"], [data-slot="combobox-empty"], [data-slot="combobox-separator"], [data-slot="combobox-chips"], [data-slot="combobox-chip"], [data-slot="combobox-chip-remove"], [data-slot="combobox-chip-input"].
Hooks
useComboboxAnchor