Preview
Loading preview…
root = Form("travel", Combobox("airport", "Departure airport", ["San Francisco (SFO)", "Tokyo Narita (NRT)", "Oslo (OSL)", "Athens (ATH)", "Ljubljana (LJU)"], placeholder:"Search airports"))A searchable select, for long lists. multiple shows the choices as chips.
Signature
This is the line a model reads in the system prompt.
Combobox(name, label, options:[str], placeholder:str, value:any, error:str, bind:$var, size:Size, hint:str, multiple, required)- Group: Forms
- Children: No
- Positional arguments:
name,label,options(a trailing?means it may be left out)
Props
| Prop | Type | How to write it | Notes |
|---|---|---|---|
name |
string | positional, required | |
label |
string | positional, required | |
options |
list of string | positional, required | |
placeholder |
string | named: placeholder:… |
|
value |
any | named: value:… |
initial option; a list with multiple |
error |
string | named: error:… |
|
bind |
$state variable |
bind:$name |
two-way binding to a $variable |
size |
sm · md · lg |
named: size:… |
Also accepts small, medium, large. |
hint |
string | named: hint:… |
|
multiple |
flag | bare word: multiple |
|
required |
flag | bare word: required |
Use your own component
Keep the name and schema, swap what is drawn. The prompt and the model’s output do not change.
import { ui } from "@gistui/react/ui";
const lib = ui.extend({ Combobox: MyCombobox });
<GistUI library={lib} stream={response.body} />;<GistUI :source="answer" :components="{ Combobox: MyCombobox }" /><GistUI source={answer} components={{ Combobox: MyCombobox }} /><GistUI source={answer()} components={{ Combobox: MyCombobox }} />import { ui } from "@gistui/vanilla/ui";
const lib = ui.extend({ Combobox: (ctx) => ({ el: myElement(ctx) }) });See Custom components for the full contract. Style hook: [data-gistui="Combobox"].