Skip to content

Item

Collapsible accordion section.

Updated View as Markdown
Preview

Loading preview…

root = Accordion(Item("Shipping", "Free over $50. Arrives in 3 to 5 days.", open), Item("Returns", "Within 30 days."), multiple)

An Item is only valid inside Accordion.

Signature

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

Item(title, ...children, open)
  • Group: Layout
  • Children: Yes: any component or text
  • Positional arguments: title (a trailing ? means it may be left out)

Props

Prop Type How to write it Notes
title string positional, required
open flag bare word: open

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({ Item: MyItem });
<GistUI library={lib} stream={response.body} />;
<GistUI :source="answer" :components="{ Item: MyItem }" />
<GistUI source={answer} components={{ Item: MyItem }} />
<GistUI source={answer()} components={{ Item: MyItem }} />
import { ui } from "@gistui/vanilla/ui";

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

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

Navigation

Type to search…

↑↓ navigate↵ selectEsc close