Inline Visualizer
Render rich visual content — SVG diagrams, HTML interactive widgets, charts — directly inline in a chat conversation. Output streams token-by-token into a sandboxed iframe. The result feels like a natural extension of the conversation, not an attachment.
How it works
You generate raw HTML or SVG fragments. The client renders them in a sandboxed iframe with the design system's CSS variables injected. No <html>, <head>, or <body> tags — just content fragments.
Two output modes:
- SVG mode: Output starts with
<svg>. Client auto-wraps in a card. Best for static diagrams.
- HTML mode: Raw HTML fragment. Best for interactive content (sliders, tabs, charts, controls). You can embed
<svg> elements inside HTML mode.
The client detects which mode based on whether the output starts with <svg.
Before generating any visual
Read the design system reference before your first visual in a conversation:
- Always read first:
references/design-system.md — CSS variables, color ramps, typography, core rules
- Then read the relevant module:
- Diagrams (flowcharts, structural, illustrative):
references/diagrams.md
- Interactive explainers, comparisons, data records:
references/components.md
- Charts (Chart.js, data viz):
references/charts.md
Read the design system file once per conversation. Read module files as needed for each visual type.
Streaming constraints
Output streams token-by-token into the DOM. This dictates structure:
<style> first (keep under 15 lines — inline styles preferred)
- Visible HTML/SVG content next (the user sees it building up)
<script> last (executes only after streaming completes)
Because of streaming:
- No gradients, drop shadows, blur, or glow — they flash during DOM diffs. Use flat fills.
- No
display:none or hidden content — it streams invisibly.
- No
<!-- comments --> or /* comments */ — waste tokens, break streaming.
- Inline
style="..." preferred over <style> blocks so elements look correct mid-stream.
- No tabs or carousels that start hidden — show everything stacked vertically during stream. Post-streaming JS can add interactivity.
Iframe sandbox rules
The visual renders in a sandboxed iframe. These are hard constraints:
- No localStorage / sessionStorage — all state must be in-memory
- No position: fixed — the iframe auto-sizes to content height; fixed elements collapse it
- No external fetches — CSP blocks API calls from inside the widget
- CDN allowlist only:
cdnjs.cloudflare.com, esm.sh, cdn.jsdelivr.net, unpkg.com
- No DOCTYPE,
<html>, <head>, <body> — just content fragments
- Background is transparent — the host provides the container/card styling
- Load libraries via
<script src="https://cdnjs.cloudflare.com/ajax/libs/..."> (UMD globals)
The sendPrompt bridge
A global sendPrompt(text) function is available inside the iframe. It sends a message to the chat as if the user typed it. Use it to make visuals conversational — clicking a node in a diagram can trigger a follow-up explanation.
Use sendPrompt when the user's next step benefits from the model thinking. Handle filtering, sorting, toggling, and calculations in local JS instead.
Choosing the right visual type
Route on the verb, not the noun. The same subject gets different treatment depending on what was asked:
| User says |
Type |
What to build |
| "how does X work" |
Illustrative diagram |
Spatial metaphor showing the mechanism |
| "what are the components of X" |
Structural diagram |
Labelled boxes showing containment |
| "walk me through the steps" |
Flowchart |
Sequential boxes and arrows |
| "compare X vs Y" |
Comparison layout |
Side-by-side cards with metrics |
| "show me the data" |
Chart |
Chart.js or inline data viz |
| "explain X" (spatial concept) |
Interactive explainer |
Sliders, controls, live state |
Default to illustrative for "how does X work" — it's the more ambitious choice. Don't retreat to a flowchart because it feels safer.
Multiple visuals per response
Generate multiple visuals in a single response, interleaved with prose:
- Text block (introduce/explain)
- Visual
- Text block (transition)
- Visual (if needed)
Never stack visuals back-to-back without text between them.
Output wrapper
Wrap visual output in a code fence with the language tag visualizer so the client detects and routes it to the iframe renderer:
```visualizer
<svg width="100%" viewBox="0 0 680 400">
...
</svg>
```
The client strips the fence and injects the content into the iframe with theme variables prepended.
Quick reference
| Rule |
Value |
| SVG viewBox width |
Always 680px |
| Font sizes |
14px labels, 12px subtitles only |
| Stroke width |
0.5px for borders and edges |
| Max colors per diagram |
2-3 ramps |
| Box subtitle length |
≤5 words |
| Corner radius (SVG) |
rx="4" default, rx="8" for emphasis |
| Corner radius (HTML) |
var(--border-radius-md) or -lg |
| Min font size |
11px |
| Text weights |
400 regular, 500 bold only |
| Heading sizes |
h1=22px, h2=18px, h3=16px |
1---2name: visualise3description: "Render inline interactive visuals — SVG diagrams, HTML widgets, charts, and explainers — directly in the conversation. Use this skill whenever the user asks to visualize, diagram, chart, illustrate, or explain something visually, or when an explanation would genuinely benefit from a spatial/interactive diagram rather than text. Also triggers for: flowcharts, architecture diagrams, data visualizations, interactive explainers, comparison layouts, UI mockups, and any request containing 'show me', 'draw', 'map out', 'visualize', or 'diagram'. Even when the user doesn't explicitly ask for a visual, use this skill proactively when the topic has spatial, sequential, or systemic relationships that a diagram would clarify better than prose."4metadata:5 source: https://skillmd.com/skills/bentossell/visualise6---78# Inline Visualizer910Render rich visual content — SVG diagrams, HTML interactive widgets, charts — directly inline in a chat conversation. Output streams token-by-token into a sandboxed iframe. The result feels like a natural extension of the conversation, not an attachment.1112## How it works1314You generate raw HTML or SVG fragments. The client renders them in a sandboxed iframe with the design system's CSS variables injected. No `<html>`, `<head>`, or `<body>` tags — just content fragments.1516**Two output modes:**1718- **SVG mode**: Output starts with `<svg>`. Client auto-wraps in a card. Best for static diagrams.19- **HTML mode**: Raw HTML fragment. Best for interactive content (sliders, tabs, charts, controls). You can embed `<svg>` elements inside HTML mode.2021The client detects which mode based on whether the output starts with `<svg`.2223## Before generating any visual2425Read the design system reference before your first visual in a conversation:26271. **Always read first**: `references/design-system.md` — CSS variables, color ramps, typography, core rules282. **Then read the relevant module**:29 - Diagrams (flowcharts, structural, illustrative): `references/diagrams.md`30 - Interactive explainers, comparisons, data records: `references/components.md`31 - Charts (Chart.js, data viz): `references/charts.md`3233Read the design system file once per conversation. Read module files as needed for each visual type.3435## Streaming constraints3637Output streams token-by-token into the DOM. This dictates structure:38391. `<style>` first (keep under 15 lines — inline styles preferred)402. Visible HTML/SVG content next (the user sees it building up)413. `<script>` last (executes only after streaming completes)4243**Because of streaming:**44- No gradients, drop shadows, blur, or glow — they flash during DOM diffs. Use flat fills.45- No `display:none` or hidden content — it streams invisibly.46- No `<!-- comments -->` or `/* comments */` — waste tokens, break streaming.47- Inline `style="..."` preferred over `<style>` blocks so elements look correct mid-stream.48- No tabs or carousels that start hidden — show everything stacked vertically during stream. Post-streaming JS can add interactivity.4950## Iframe sandbox rules5152The visual renders in a sandboxed iframe. These are hard constraints:5354- **No localStorage / sessionStorage** — all state must be in-memory55- **No position: fixed** — the iframe auto-sizes to content height; fixed elements collapse it56- **No external fetches** — CSP blocks API calls from inside the widget57- **CDN allowlist only**: `cdnjs.cloudflare.com`, `esm.sh`, `cdn.jsdelivr.net`, `unpkg.com`58- **No DOCTYPE, `<html>`, `<head>`, `<body>`** — just content fragments59- Background is transparent — the host provides the container/card styling60- Load libraries via `<script src="https://cdnjs.cloudflare.com/ajax/libs/...">` (UMD globals)6162## The sendPrompt bridge6364A global `sendPrompt(text)` function is available inside the iframe. It sends a message to the chat as if the user typed it. Use it to make visuals conversational — clicking a node in a diagram can trigger a follow-up explanation.6566Use `sendPrompt` when the user's next step benefits from the model thinking. Handle filtering, sorting, toggling, and calculations in local JS instead.6768## Choosing the right visual type6970Route on the verb, not the noun. The same subject gets different treatment depending on what was asked:7172| User says | Type | What to build |73|-----------|------|---------------|74| "how does X work" | Illustrative diagram | Spatial metaphor showing the mechanism |75| "what are the components of X" | Structural diagram | Labelled boxes showing containment |76| "walk me through the steps" | Flowchart | Sequential boxes and arrows |77| "compare X vs Y" | Comparison layout | Side-by-side cards with metrics |78| "show me the data" | Chart | Chart.js or inline data viz |79| "explain X" (spatial concept) | Interactive explainer | Sliders, controls, live state |8081Default to illustrative for "how does X work" — it's the more ambitious choice. Don't retreat to a flowchart because it feels safer.8283## Multiple visuals per response8485Generate multiple visuals in a single response, interleaved with prose:86871. Text block (introduce/explain)882. Visual893. Text block (transition)904. Visual (if needed)9192Never stack visuals back-to-back without text between them.9394## Output wrapper9596Wrap visual output in a code fence with the language tag `visualizer` so the client detects and routes it to the iframe renderer:9798````99```visualizer100<svg width="100%" viewBox="0 0 680 400">101 ...102</svg>103```104````105106The client strips the fence and injects the content into the iframe with theme variables prepended.107108## Quick reference109110| Rule | Value |111|------|-------|112| SVG viewBox width | Always 680px |113| Font sizes | 14px labels, 12px subtitles only |114| Stroke width | 0.5px for borders and edges |115| Max colors per diagram | 2-3 ramps |116| Box subtitle length | ≤5 words |117| Corner radius (SVG) | rx="4" default, rx="8" for emphasis |118| Corner radius (HTML) | `var(--border-radius-md)` or `-lg` |119| Min font size | 11px |120| Text weights | 400 regular, 500 bold only |121| Heading sizes | h1=22px, h2=18px, h3=16px |122