Agents can output structured content using <artifact> tags. The chat UI detects these
markers and renders them as interactive visual cards with copy, download, and fullscreen controls.
<artifact type="TYPE" title="TITLE">
CONTENT
</artifact>
| Type | Content | Rendering |
|---|---|---|
html |
HTML markup | Sandboxed iframe, DOMPurify-sanitized |
react |
JSX component (function App) | Babel + Tailwind in sandboxed iframe |
svg |
SVG markup | Inline, DOMPurify-sanitized |
chart |
JSON spec | Interactive Recharts component |
csv |
CSV with header row | Sortable data table |
markdown |
Markdown text | Full markdown pipeline |
code |
Source code | Prism syntax highlighting |
interactive |
JSON component spec | Rendered inline as interactive UI widgets |
{
"type": "line",
"data": [{"month": "Jan", "sales": 100}, {"month": "Feb", "sales": 150}],
"xKey": "month",
"series": [{"key": "sales", "color": "#8884d8", "name": "Sales"}],
"title": "Monthly Sales"
}
Chart types: line, bar, pie, area, scatter, composed. Max 1000 data points, 10 series.
Pie chart uses different fields: {"type":"pie","data":[{"name":"A","value":100}],"dataKey":"value","nameKey":"name"}
Composed chart mixes types: series items can have "type":"line"|"bar"|"area" to overlay different chart types on the same axes.
Use artifacts for:
Do NOT use artifacts for:
The code type accepts an optional language attribute:
<artifact type="code" language="python" title="Data Processor">
def process(items):
return [transform(i) for i in items]
</artifact>
React artifacts run in a sandboxed iframe with:
React)AppNo imports needed — React and ReactDOM are pre-loaded.
Content must NOT contain literal </artifact>. Use </artifact> if documenting the protocol itself.
| Type | Renders | On Click |
|---|---|---|
chart |
Inline in message (interactive Recharts) | — |
svg |
Inline in message (DOMPurify sanitized) | — |
code |
Inline in message (Prism highlighting) | — |
html, react, markdown |
Preview card in message | Opens sidebar panel |
csv |
Preview card in message | Sortable data table in sidebar |
interactive |
Rendered inline in message | No modal — widgets render directly in chat |
When series is omitted from chart specs, series are auto-inferred from numeric data keys.
App (or Default as fallback)sandbox="allow-scripts", no allow-same-origin)connect-src: none), but React artifacts load dependencies from CDNs