Embed
Put a diagram on your page
A TakeSix diagram works on any web page: documentation, a blog, a wiki, an internal portal. The page does not need React or a build step. Readers click into blocks right there, without leaving the page.
Which one
- An iframe with a self-contained HTML file: nothing to load from elsewhere, works even where scripts on the page are not allowed. One file per diagram.
- The
<take-six>element: one script, then a tag per diagram that reads the.takesix.jsonfile directly. Best when you keep the JSON next to your docs and update it often.
An iframe
Turn the JSON into one HTML file with the viewer inside. It opens without a server or network, so any static host serves it:
npx @takesix/react build architecture.takesix.json # writes architecture.htmlThe editor makes the same file: Save as HTML in the menu of the editor. Put the file next to your page and embed it:
<iframe
src="/diagrams/architecture.html"
title="Architecture of the shop"
style="width: 100%; height: 480px; border: 0"
></iframe>To open the diagram at one block, add its address to the link: architecture.html#in=api. “Copy link to this screen” in the diagram’s menu gives such a link.
The <take-six> element
Load the script once, from npm through the jsDelivr CDN (or unpkg). @1 keeps you on version 1 with its fixes; pin an exact version such as @1.3.0 if you prefer. Then each <take-six> tag shows a diagram:
<script src="https://cdn.jsdelivr.net/npm/@takesix/react@1/dist/element.js" defer></script>
<take-six src="/diagrams/architecture.takesix.json"></take-six>This is such an element, with the architecture example inside it. Click a block:
The file in src is fetched by the browser, so it must be on the same site or served with CORS (GitHub raw files are). The document can also sit inside the tag, which needs no extra request:
<take-six theme="dark" view="in=api" style="height: 600px">
<script type="application/json">
{ "takesix": "1.2", "title": "Online shop", "blocks": [ … ] }
</script>
</take-six>The diagram lives in a shadow root: your page’s CSS does not change the diagram, and the diagram’s CSS does not touch your page. Several diagrams on one page work independently. A diagram that cannot be shown says why in its own box.
Attributes
| Attribute | What it does |
|---|---|
src | URL of the .takesix.json file. Without it, the element reads the <script type="application/json"> inside it. |
theme | auto (the reader’s system setting, default), light or dark. |
view | The screen to open: in=api opens the block api, at=api shows its level with the block highlighted. Without it, a link like page.html#in=api opens the diagram that has that block. |
menu | Shows the diagram’s menu: open in the editor, copy a link, save as JSON. |
Change an attribute from a script and the diagram follows: a new src loads a new file.
Size and style
The element is a block 30rem tall. Set its height, border or margins like any other element; the diagram fits its blocks into whatever room it gets:
take-six {
height: 70vh;
border: 1px solid #d9dee5;
border-radius: 12px;
}In a React app
Use the component itself from @takesix/react: it shares React with your app and lets you control the screen on display, the theme and editing from code.
No diagram yet? Ask your AI agent for one, or build it in the editor. The format is explained in plain words.