Skip to content

CheckboxGroup

Pick many; v:cards (icons/images, hints), v:chips toggle pills.

Updated View as Markdown
Preview

Loading preview…

root = Form("prefs", CheckboxGroup("topics", "Topics", ["Product", "Engineering", "Design", "Research"], v:chips, value:["Product"], min:1, max:3, hint:"Pick up to three"))

Signature

This is the line a model reads in the system prompt.

CheckboxGroup(name, label, options:[str], hints:[str], icons:[str], images:[str], cols:num, value:[str], min:num, max:num, error:str, v:list|cards|chips, dir:Dir, bind:$var, size:Size, hint:str, 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
hints list of string named: hints:… one line per option
icons list of string named: icons:… icon per option (cards)
images list of string named: images:… image URL per option (cards)
cols number named: cols:… card columns
value list of string named: value:… initially checked options
min number named: min:… fewest that must be picked
max number named: max:… most that can be picked
error string named: error:…
v list · cards · chips named: v:… Default "list".
dir col · row named: dir:…
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:…
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({ CheckboxGroup: MyCheckboxGroup });
<GistUI library={lib} stream={response.body} />;
<GistUI :source="answer" :components="{ CheckboxGroup: MyCheckboxGroup }" />
<GistUI source={answer} components={{ CheckboxGroup: MyCheckboxGroup }} />
<GistUI source={answer()} components={{ CheckboxGroup: MyCheckboxGroup }} />
import { ui } from "@gistui/vanilla/ui";

const lib = ui.extend({ CheckboxGroup: (ctx) => ({ el: myElement(ctx) }) });

See Custom components for the full contract. Style hook: [data-gistui="CheckboxGroup"].

Navigation

Type to search…

↑↓ navigate↵ selectEsc close