Skip to content

Card

Surface for related content.

Updated View as Markdown
Preview

Loading preview…

root = Grid(Card(Header("Card", size:sm), "The default surface."), Card(Header("Sunk", size:sm), "A quieter, inset surface.", v:sunk), Card(Header("Outline", size:sm), "A border, no fill.", v:outline), cols:3)

Signature

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

Card(...children, v:card|sunk|outline|clear, gap:Gap, accent:Accent)
  • Group: Layout
  • Children: Yes: any component or text
  • Positional arguments: none

Props

Prop Type How to write it Notes
v card · sunk · outline · clear named: v:… Default "card".
gap none · xs · sm · md · lg · xl named: gap:… Also accepts small, medium, large.
accent neutral · slate · stone · rose · pink · violet · indigo · blue · teal · green · orange · amber · red named: accent:… Also accepts purple, gray, grey, zinc, yellow.

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

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

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

Navigation

Type to search…

↑↓ navigate↵ selectEsc close