This component is returned by
useForm().Example: Pre-defined options
pick-color-dialog.tsx
Example: Asynchronously loaded options
github-user-schema.ts
fetch() from the client, we need to define server functions
to talk to the third party API.
get-github-user.server.ts
search-github-users.server.ts
github-options-provider.ts
<Combobox />.
pick-github-user-dialog.tsx
Props
string
required
The label of the combobox field.
string
required
The path to the
string value of the input field in your form schema.e.g. "status", "shipping.address.state"Array<ComboboxOption> | ComboboxOptionsProvider
required
Either an array of ComboboxOptions, or a
ComboboxOptionsProvider to load them.
boolean
If
decorated is true, the combobox requires decorated options, meaning that each option must
provide one of avatarUrl, color, or icon.string
An optional placeholder text for your input.
boolean
Whether or not the field should be disabled.
ComboboxOption
An object containing:string
required
The value that will be saved into your form data when this option is selected.
string
required
The label the user will see for this option
string
An optional description the user will see for this option
string
An optional avatar to display for this option
string
An optional CSS color for the option. It will be displayed in a little circle next to the label.
Combobox Option Decorations
The priority of decorations goes:- Avatar
- Color
- Icon
CategorizedComboboxOption
An object that extendsComboboxOption and also includes:
string
A category label to display this option under
ComboboxOptionProvider
An object containing:(value: string) => Promise<Omit<ComboboxOption, 'value'>>
An async function that, given an option value, fetches the rest of the
ComboboxOption.(query: string) => Promise<ComboboxOption[] | CategorizedComboboxOption[]>
An async function that, given a search query, fetches an array of “matching”
ComboboxOptions.What “matching” means is up to the developer.