Skip to content
Eskais UI

Server data

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

Installation

npx shadcn@latest add @eskais/server-combobox
npm packageslucide-react

Usage

Import
import { ServerCombobox, serverComboboxLabels } from "@/components/ui/server-combobox"

Use it when the options live on the server: people, tasks, anything too long to load at once.

API reference

ServerCombobox

PropTypeDefault
sourcerequiredPageSource<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-labelstring–
placeholderstring–
pageSizenumber–
debounceHow long typing must pause before a search, in ms. Default 250.number–
disabledboolean–
labelsPartial<ServerComboboxLabels>–
localeWrites the count in the status; the page's `<html lang>` by default (`useLocale`).string–
classNamestring–
multiplefalse | true–
valuestring | null | readonly string[]–
defaultValuestring | null | readonly string[]–
onValueChange(value: string | null, change: ServerComboboxChange) => void | (value: string[], change: ServerComboboxChange) => void–

Other exports

serverComboboxLabelstype ServerComboboxChangetype ServerComboboxLabelstype ServerComboboxMultiplePropstype ServerComboboxPropstype ServerComboboxSingleProps

Accessibility

  • 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.