Basic Usage
ACombobox is a container for ComboboxOption children. The label can be passed as a positional argument; the value is what gets stored in state when that option is selected:
Reading the Value
Use.rx to get a reactive reference to the selected option’s value string. Embed it in other components to display the current selection:
Search for an option and select it — the text updates instantly to show the selected value.
Search Placeholder
Thesearch_placeholder parameter customizes the hint text inside the search input that appears when the dropdown opens:
With Label
Pair aCombobox with a Label in a Column for a standard form field pattern:
Disabled State
A disabled combobox is non-interactive — the trigger button is grayed out and the dropdown won’t open:Disabled Options
Individual options can be disabled while the rest remain selectable. Disabled options still appear in the list but can’t be chosen — useful for options that exist but aren’t currently available:Invalid State
Setinvalid=True to indicate a validation error. The trigger shows a red border, making it clear the user needs to correct their selection. Pair it with a Label and error text for a complete form field:
Separators
UseComboboxSeparator to add visual dividers between flat options without needing full group containers. Separators are lightweight — they just draw a line to create logical sections:
Option Groups
Organize related options withComboboxGroup and ComboboxLabel. Each group gets a non-selectable header label, and groups are automatically separated by dividers in the dropdown:
Actions
Theon_change parameter fires actions when the selection changes. Inside the action, $event holds the newly selected value string:
This is different from .rx — here we’re transforming the value before storing it (prepending “Boarding: ”). For simple “show the current selection” cases, .rx is the better approach.
Side and Align
Control where the dropdown appears relative to the trigger withside and align. This is useful when the combobox is near the edge of a viewport or inside a constrained layout:
API Reference
Combobox Parameters
Text shown when no value is selected.
Placeholder text in the search input.
State key for the selected value.
Whether the combobox is non-interactive.
Whether the combobox is in an error state.
Which side to show the dropdown.
Alignment of the dropdown relative to the trigger.
Action(s) to execute when the selection changes.
$event is the value string of the selected option.Additional Tailwind CSS classes.
ComboboxGroup Parameters
Container for grouping related options. Children should be
ComboboxLabel and ComboboxOption components.ComboboxLabel Parameters
Label text. Can be passed as a positional argument.
ComboboxSeparator Parameters
Visual divider between options. No parameters.
Protocol Reference
Combobox
ComboboxOption
ComboboxGroup
ComboboxLabel
ComboboxSeparator