# Combobox
> Searchable dropdown with filtering and selection
Source: https://shellui.dev/docs/v0.4/components/advanced/combobox
The Combobox component provides a dropdown with built-in search filtering. It accepts a list of string options and supports two-way binding, custom placeholders, and disabled state.
## Installation
```bash
shellui add combobox
```
## Basic Usage
```razor
Selected: @(selected ?? "None")
@code {
private string? selected;
private List frameworks = new()
{
"Blazor", "React", "Vue", "Angular", "Svelte", "Next.js"
};
}
```
## With Search Filtering
Search is enabled by default. Type to filter the options list:
```razor
@code {
private string selectedCountry = "";
private List countries = new()
{
"United States", "United Kingdom", "Germany",
"France", "Japan", "Australia", "Canada",
"Brazil", "India", "South Korea"
};
}
```
## Disabled State
```razor
@code {
private string selected = "";
private List options = new() { "Blazor", "React", "Vue" };
}
```
## Without Search
Disable the search input for short option lists:
```razor
@code {
private string selectedSize = "";
private List sizes = new() { "Small", "Medium", "Large", "X-Large" };
}
```
## In a Form
```razor
@code {
private UserModel model = new();
private List roles = new()
{
"Admin", "Editor", "Viewer", "Contributor"
};
private List departments = new()
{
"Engineering", "Design", "Marketing", "Sales", "Support"
};
private void HandleSubmit() { /* Handle */ }
class UserModel
{
public string Role { get; set; } = "";
public string Department { get; set; } = "";
}
}
```
## With Custom Content
Use `ChildContent` to render custom dropdown content:
```razor
@foreach (var color in colors)
{
selected = color.Name">
@color.Name
}
@code {
private string selected = "";
private List colors = new()
{
new("Red", "#ef4444"),
new("Blue", "#3b82f6"),
new("Green", "#22c55e"),
new("Purple", "#a855f7")
};
record ColorItem(string Name, string Hex);
}
```
## API Reference
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `Value` | `string` | `""` | Currently selected value |
| `ValueChanged` | `EventCallback` | — | Two-way binding callback |
| `Options` | `IEnumerable?` | `null` | List of string options |
| `Placeholder` | `string` | `"Select..."` | Placeholder text when nothing is selected |
| `Searchable` | `bool` | `true` | Show search input in dropdown |
| `Disabled` | `bool` | `false` | Disable the combobox |
| `ChildContent` | `RenderFragment?` | `null` | Custom dropdown content (replaces `Options`) |
| `Class` | `string?` | `null` | Additional CSS classes |
## Accessibility
The Combobox component includes:
- `role="combobox"` with `aria-expanded`
- Arrow key navigation through options
- Enter to select, Escape to close
- `aria-selected` on the active option
- Click-outside overlay to dismiss
- Selected option shows a checkmark indicator