Server Combobox
A Combobox whose options come from a PageSource, searched on the server as you type: requests wait for typing to pause and are aborted when replaced, the next page loads at the end of the list, and the server's order is kept. With multiple, choices show as chips.
Example
Show options
server-combobox-demo.tsxCopy code
Installation
Copy code
npm packages
lucide-reactUsage
ImportCopy code
Use it when the options live on the server: people, tasks, anything too long to load at once.
API reference
ServerCombobox
| Prop | Type | Default |
|---|---|---|
sourcerequired | PageSource<T, { q?: string }> | – |
getLabelrequired | (item: T) => string | – |
getValueThe value an item stores. Default: the source's `getId`. | (item: T) => string | – |
valueLabelsLabels of values chosen before their options load, like ids read from the URL. | Readonly<Record<string, string>> | – |
aria-label | string | – |
placeholder | string | – |
pageSize | number | – |
debounceHow long typing must pause before a search, in ms. Default 250. | number | – |
disabled | boolean | – |
labels | Partial<ServerComboboxLabels> | – |
localeWrites the count in the status; the page's `<html lang>` by default (`useLocale`). | string | – |
className | string | – |
multiple | false | true | – |
value | string | null | readonly string[] | – |
defaultValue | string | null | readonly string[] | – |
onValueChange | (value: string | null, change: ServerComboboxChange) => void | (value: string[], change: ServerComboboxChange) => void | – |
Other exports
serverComboboxLabelstype ServerComboboxChangetype ServerComboboxLabelstype ServerComboboxMultiplePropstype ServerComboboxPropstype ServerComboboxSinglePropsAccessibility
- A UI SDK Combobox: the list keeps the server's order, and a hidden status announces loading, errors and the count.
- Each chip's remove button is named for its choice.
Agent actions
Agents choose an option by its label, as in any Combobox.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.