Combobox
Autocomplete input with a list of suggestions.
Installation
Usage
<Combobox Items="Frameworks">
<ComboboxInput Placeholder="Select a framework" />
<ComboboxContent>
<ComboboxEmpty>No items found.</ComboboxEmpty>
<ComboboxList>
<Template Context="item">
<ComboboxItem Value="@item">@item</ComboboxItem>
</Template>
</ComboboxList>
</ComboboxContent>
</Combobox>
@code {
private static readonly string[] Frameworks = ["Next.js", "SvelteKit", "Nuxt.js", "Remix", "Astro"];
}Composition
Simple
A single-line input and a flat list (see Basic).
Combobox
├── ComboboxInput
└── ComboboxContent
├── ComboboxEmpty
└── ComboboxList
├── ComboboxItem
└── ComboboxItemWith chips
Multi-select with Multiple, chips, and a chips input (see Multiple).
Combobox
├── ComboboxChips
│ ├── ComboboxValue
│ │ └── ComboboxChip
│ └── ComboboxChipsInput
└── ComboboxContent
├── ComboboxEmpty
└── ComboboxList
├── ComboboxItem
└── ComboboxItemWith groups and collection
Nested items per group using ComboboxCollection inside each ComboboxGroup, with a separator between groups (see Groups).
Combobox
├── ComboboxInput
└── ComboboxContent
├── ComboboxEmpty
└── ComboboxList
├── ComboboxGroup
│ ├── ComboboxLabel
│ └── ComboboxCollection
│ ├── ComboboxItem
│ └── ComboboxItem
├── ComboboxSeparator
└── ComboboxGroup
├── ComboboxLabel
└── ComboboxCollection
├── ComboboxItem
└── ComboboxItemCustom Items
Items are string values. When your items are objects, use their values as the items and ItemToLabel to name them.
<Combobox Items="@Frameworks.Select(f => f.Value)" ItemToLabel="LabelOf">
<ComboboxInput Placeholder="Select a framework" />
<ComboboxContent>
<ComboboxEmpty>No items found.</ComboboxEmpty>
<ComboboxList>
<Template Context="value">
<ComboboxItem Value="@value">@LabelOf(value)</ComboboxItem>
</Template>
</ComboboxList>
</ComboboxContent>
</Combobox>
@code {
private sealed record Framework(string Label, string Value);
private static readonly Framework[] Frameworks =
[
new("Next.js", "next"),
new("SvelteKit", "sveltekit"),
new("Nuxt", "nuxt"),
];
private static string LabelOf(string value) => Frameworks.First(f => f.Value == value).Label;
}Multiple Selection
Use Multiple with chips for multi-select behavior.
<Combobox Items="Frameworks" Multiple="true" @bind-Values="_values">
<ComboboxChips id="frameworks-chips">
<Template Context="item">
<ComboboxChip Value="@item">@item</ComboboxChip>
</Template>
<ChildContent>
<ComboboxChipsInput Placeholder="Add framework" />
</ChildContent>
</ComboboxChips>
<ComboboxContent Anchor="frameworks-chips">
<ComboboxEmpty>No items found.</ComboboxEmpty>
<ComboboxList>
<Template Context="item">
<ComboboxItem Value="@item">@item</ComboboxItem>
</Template>
</ComboboxList>
</ComboboxContent>
</Combobox>
@code {
private static readonly string[] Frameworks = ["Next.js", "SvelteKit", "Nuxt.js", "Remix", "Astro"];
private IReadOnlyList<string> _values = [];
}Basic
A simple combobox with a list of frameworks.
Multiple
A combobox with multiple selection using Multiple and ComboboxChips.
Clear Button
Use the ShowClear parameter to show a clear button.
Groups
Use ComboboxGroup and ComboboxSeparator to group items.
Custom Items
You can render a custom component inside ComboboxItem.
Invalid
Use the aria-invalid parameter to make the combobox invalid.
Disabled
Use the Disabled parameter to disable the combobox.
Auto Highlight
Use the AutoHighlight parameter to automatically highlight the first item on filter.
Popup
You can trigger the combobox from a button or any other component by using the Render parameter. Move the ComboboxInput inside the ComboboxContent.
Input Group
You can add an addon to the combobox by using the InputGroupAddon component inside the ComboboxInput.
RTL
To enable RTL support in Blazix, see the RTL configuration guide.
Translated with AI for the demo, so it may have mistakes.
API Reference
Combobox
ComboboxChip
Other attributes are passed to the element it renders.
ComboboxChips
Other attributes are passed to the element it renders.
ComboboxChipsInput
Other attributes are passed to the element it renders.
ComboboxClear
Other attributes are passed to the element it renders.
ComboboxCollection
ComboboxContent
Other attributes are passed to the element it renders.
ComboboxEmpty
Other attributes are passed to the element it renders.
ComboboxGroup
Other attributes are passed to the element it renders.
ComboboxInput
Other attributes are passed to the element it renders.
ComboboxItem
Other attributes are passed to the element it renders.
ComboboxLabel
Other attributes are passed to the element it renders.
ComboboxList
Other attributes are passed to the element it renders.
ComboboxSeparator
Other attributes are passed to the element it renders.
ComboboxTrigger
Other attributes are passed to the element it renders.
ComboboxValue
Other attributes are passed to the element it renders.