Preview
Loading preview…
root = Grid(Media("https://images.unsplash.com/photo-1540959733332-eab4deabeeaf?w=900&q=75&auto=format&fit=crop", title:"Tokyo", subtitle:"Japan's futuristic capital", tag:"Must-see", v:overlay), Media("https://images.unsplash.com/photo-1493976040374-85c8e12f0c0e?w=900&q=75&auto=format&fit=crop", title:"Kyoto", subtitle:"Thousands of shrines", tag:"Cultural", meta:"2 days"), cols:2)Signature
This is the line a model reads in the system prompt.
Media(src, title:str, subtitle:str, tag:str, meta:str, v:below|overlay|cover, ratio:str, href:str, alt:str, do:[@step…], zoom)- Group: Content
- Children: No
- Positional arguments:
src(a trailing?means it may be left out)
Props
| Prop | Type | How to write it | Notes |
|---|---|---|---|
src |
string (URL) | positional, required | |
title |
string | named: title:… |
|
subtitle |
string | named: subtitle:… |
|
tag |
string | named: tag:… |
|
meta |
string | named: meta:… |
|
v |
below · overlay · cover |
named: v:… |
Default "below". caption position |
ratio |
string | named: ratio:… |
|
href |
string | named: href:… |
|
alt |
string | named: alt:… |
|
zoom |
flag | bare word: zoom |
click opens a lightbox |
do |
action list | named: do:… |
steps run on click |
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({ Media: MyMedia });
<GistUI library={lib} stream={response.body} />;<GistUI :source="answer" :components="{ Media: MyMedia }" /><GistUI source={answer} components={{ Media: MyMedia }} /><GistUI source={answer()} components={{ Media: MyMedia }} />import { ui } from "@gistui/vanilla/ui";
const lib = ui.extend({ Media: (ctx) => ({ el: myElement(ctx) }) });See Custom components for the full contract. Style hook: [data-gistui="Media"].