Preview
Loading preview…
root = Form("consent", Checkbox("terms", "I accept the terms", required), Checkbox("news", "Send me product news", checked))Signature
This is the line a model reads in the system prompt.
Checkbox(name, label, bind:$var, error:str, checked, required)- Group: Forms
- Children: No
- Positional arguments:
name,label(a trailing?means it may be left out)
Props
| Prop | Type | How to write it | Notes |
|---|---|---|---|
name |
string | positional, required | |
label |
string | positional, required | |
bind |
$state variable |
bind:$name |
two-way binding to a $variable |
checked |
flag | bare word: checked |
|
required |
flag | bare word: required |
|
error |
string | named: error:… |
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({ Checkbox: MyCheckbox });
<GistUI library={lib} stream={response.body} />;<GistUI :source="answer" :components="{ Checkbox: MyCheckbox }" /><GistUI source={answer} components={{ Checkbox: MyCheckbox }} /><GistUI source={answer()} components={{ Checkbox: MyCheckbox }} />import { ui } from "@gistui/vanilla/ui";
const lib = ui.extend({ Checkbox: (ctx) => ({ el: myElement(ctx) }) });See Custom components for the full contract. Style hook: [data-gistui="Checkbox"].