Build diagrams — visually or as code.
Two ways to work, one diagram. Use the visual editor to draw on a canvas, or the Code to Diagram panel to write a small, readable YAML — they stay in sync. This guide covers both, and every code example is rendered live beside it.
Introduction
What is Gramit?
Gramit is a browser-based editor for hierarchical diagrams — flowcharts, system architecture, mind maps and more. Its defining feature is subflows: any node can contain an entire sub-diagram, so big systems break down into navigable levels. No account, no server — your work stays in your browser.
Two ways to build
You can create the same diagram in whichever way fits the moment — and switch freely, since both stay in sync.
Core concepts
Quick start
On the canvas
- Pick a shape from the toolbar at the top (or press a shortcut like
N). - Click the canvas to drop a node, then double-click it to type a label.
- Hover a node's edge and drag from a handle to another node to connect them.
- Select a node to open the properties panel and restyle it.
With code
- Open the ☰ Menu (top of the editor) and choose Code to Diagram.
- A panel opens with the current diagram expressed as Gramit Code.
- Edit the YAML — the canvas updates automatically after a short pause.
- Mistakes are underlined in red, with autocomplete as you type.
Here is a complete, valid diagram — and exactly what it renders:
Use with AI
You don't have to write Gramit Code by hand. There's a single, plain-text version of this entire reference, built for AI assistants. Hand the link to any chat AI (ChatGPT, Claude, Gemini, …) and it can read the whole spec and generate diagrams for you.
How to use it
- Copy the link above.
- Paste it into your AI chat together with a description of the diagram you want.
- The AI reads the spec and replies with Gramit Code (YAML).
- In Gramit, open ☰ Menu → Code to Diagram and paste the YAML — the canvas renders it.
A prompt you can copy and adapt:
robots.txt.Canvas & navigation
The editor is an infinite canvas. The toolbar sits at the top, your saved diagrams and assets open from the left, and settings live behind the ☰ Menu at the top-right.
Pan & zoom
- Pan — scroll, or drag an empty part of the canvas with the Pointer tool.
- Zoom —
Ctrl/⌘+ scroll, or pinch on a trackpad. - Zoom to fit — frame the whole diagram with
Shift+1.
Selecting
- Click a node or edge to select it;
Shift-click to add to the selection. - Drag on empty canvas to rubber-band a group of nodes.
- Press
Escto clear the selection and return to the Pointer tool.
Zoom controls
The zoom indicator sits at the bottom-left. Hover it to reveal zoom-in, zoom-out and zoom-to-fit actions. The current zoom percentage is always visible.
Tools
The top toolbar holds every creation tool. Pick one, then click the canvas to place it. Most tools have a one-key shortcut — pressing it selects the tool without touching the mouse.
Pointer & laser
- Pointer (
V) — select, move and resize. The default tool. - Laser (
L) — a temporary pointer trail for presenting; it draws nothing permanent.
Shapes
Each shape tool drops a node you can immediately label and style. Frame is the exception — it's a background container, drawn by dragging.
Free arrow
The Arrow tool (A) draws a standalone arrow that isn't bound to any node — handy for annotations and callouts. Click to place the start point, move the mouse, then click again to finish. Hold Ctrl/⌘ while clicking mid-draw to drop an elbow and keep extending the tip; press Esc to cancel the arrow you're drawing.
- Every point on a finished arrow — including its endpoints — stays reshapeable via a small drag handle.
- The properties panel offers the same styling as an edge: stroke, arrowheads, and an Arrow type of curved, smooth or step (orthogonal).
from/to node to anchor to, so it doesn't appear in Code to Diagram — it's canvas-only and survives a code sync untouched.Text
The Text tool (T) drops a free-floating label with no border or fill. Resizing a text node scales its font size rather than wrapping the text.
Person, icons & images
- Person (
P) — a person glyph for actors and users in context diagrams. - Icons — open the icon picker, search thousands of provider/tech icons, and click one to drop it. See also the icon node in code.
- Images — open My Assets to upload and place images, or drag/paste an image straight onto the canvas.
Code nodes
The Code tool (C) drops a syntax-highlighted code block. Pick the language from the node's properties; supported languages are JSON, JavaScript, TypeScript, Python, HTML, CSS and Markdown.
Editing nodes
Move & resize
- Drag a node to move it; drag a selection to move them together.
- Select a node to show resize handles at its corners and edges, then drag to resize.
Editing labels
Double-click a node to edit its text. Press Esc or click away to finish.
Properties panel
Selecting a node or edge opens the properties panel on the right. It adapts to what's selected — stroke and fill colors, stroke width and style, corner rounding, sketch roughness, opacity, and type-specific options like image size or code language.
Layers & order
When shapes overlap, use the panel's layer actions — send to back, send backward, bring forward, bring to front — to control stacking.
Copy, cut & paste
Ctrl/⌘+C/X/Vto copy, cut and paste. Pasted copies are offset so they don't land exactly on the original.- Duplicate a selection from the properties panel. Duplicating a node that has a subflow clones the whole nested tree.
- You can paste images and text copied from outside the app directly onto the canvas.
Connecting nodes
Drawing connections
Hover a node to reveal its connection handles on each side. Drag from a handle to another node to create an edge. Gramit picks the best entry and exit sides automatically and re-routes as you move nodes around.
Styling connections
Select an edge to restyle it in the properties panel: line color, width and style (solid / dashed), a straight or curved path, arrowheads, an optional label, and sketch roughness.
Bending a connection
Select an edge and a small dot appears at its center — drag it to bend the connection through that point. The source and target stay exactly where they are; only the middle moves. If the edge has a text label, the label itself is the handle, so there's nothing extra to grab.
Styling & themes
Colors & fills
Every shape has a stroke (border) and a fill color. Set the fill to transparent to show a pattern instead — hatch, cross-hatch or dots. Colors accept hex and rgb/rgba values.
Sketch style
The sloppiness control gives shapes and edges a hand-drawn look, from clean and precise to loose and rough. It's purely visual and applies per node or edge.
Themes & style profiles
From the ☰ Menu you can switch:
Subflows & levels
Subflows are Gramit's signature feature: any node can hold an entire diagram inside it, letting you build layered, drillable systems.
Creating a subflow
Select a node and choose Create subflow in the properties panel. The node gets a small indicator showing it now contains a nested flow.
Navigating levels
- Drill in — open a node's subflow to edit it as its own canvas.
- Go up — return to the parent level with
Alt+↑. - The breadcrumb at the bottom shows your path and lets you jump to any level.
Preview panels
Sliding panels show the parent level on the left and a child subflow on the right, so you can keep context while you work and expand a preview into the full canvas when you're ready.
My Diagrams
The My Diagrams panel (the gallery, opened from the left) holds every diagram in this browser — or in your account when signed in.
Saving & loading
Your work autosaves as you go. Open My Diagrams to switch between diagrams or start a new one. Signed in, diagrams sync to your account and follow you across devices; otherwise they're stored locally in your browser.
Rename, clone, delete
Each entry can be renamed, duplicated (a full copy, including subflows) or deleted from the gallery.
Public sharing
Share publishes a read-only copy at a public link anyone can open — handy for reviews and docs. Turn sharing off at any time to revoke access.
My Assets
My Assets is your personal image library, opened from the toolbar's image tool. Upload once, then reuse images across diagrams.
Adding images
- Click Upload in My Assets, or drag an image file onto the panel.
- Drag or paste an image straight onto the canvas to add it and store it as an asset.
Renaming & storage
- Rename from the right-click menu (or double-click the name). Names allow letters, numbers and spaces — no special characters.
- Assets are cloud (synced to your account) or local (this browser only); the icon on each thumbnail shows which.
Placing on canvas
Double-click an asset, or drag it onto the canvas, to create an image node. The same image can be reused any number of times.
assets/<name> paths — see Assets in the code reference.Export & share
Export as image
Open Export as Image from the ☰ Menu (or press Ctrl/⌘ + P). A preview opens where you can pan and zoom before downloading.
Options
Keyboard shortcuts
Single-key tool shortcuts work whenever you're not typing in a field.
Document structure
A Gramit document is a YAML mapping with up to three kinds of top-level keys. Only root is required.
root and every subflow. Edges reference nodes by that name.Template
The optional template block sets diagram-wide defaults.
theme or style from code also switches the editor to match — handy for sharing a diagram exactly as you intend it to look.Nodes
Every entry under nodes: needs a unique name. Everything else is optional and falls back to the active style.
name is the node's id, not its visible label — that's text. Keep names short and code-friendly (e.g. login_form); put the human wording in text.Node types
The type field decides the shape and which properties apply. Omit it for a plain rectangle. Here are the geometric types side by side:
Each type accepts a different set of visual properties:
name, type, text and opacity are always allowed. Anything outside a type's supported list is flagged as an error.Visual properties
Any property you omit inherits from the active diagram style. Mix and match these on the node types that support them.
Property reference
Type-specific notes
- person —
strokecan't betransparent;fillandstroke_stylearen't supported. - circle —
edgeshas no effect (circles are always round). - icon — only
iconandopacityapply; colors are ignored. - image —
url,width,height,size,color,edgesandopacityapply. - code —
textis the code content (not a label);languageis required.
Type-specific fields
Four node types take extra fields beyond the visual properties above.
icon node
Shows an icon with a label underneath. The icon field is an icon id from the built-in library — the same ids you get from the icon picker (e.g. cloud/compute/aws/lambda).
image node
Embeds an image. url can be a full URL or a compact asset path (assets/…) — see Assets.
Control the rendered size in one of two ways:
Use width + height for precise dimensions, or size to scale proportionally. A single width or height scales the other to keep the aspect ratio.
width/height take priority over size. When you resize an image on the canvas, it serializes back to concrete width and height values.code node
Renders a syntax-highlighted code block. Both language and text are required.
person node
A person glyph for actors and users.
Edges
Edges connect two nodes by name. Both from and to must reference existing nodes.
from and to are optional and fall back to the active style's defaults.Subflows
Any top-level key other than template and root defines a subflow — a nested diagram you can open from the editor. Use them to break a big flow into drillable levels.
welcome in a subflow can't be reused in root or any other subflow. The preview above shows root; the subflow opens as a separate level in the editor.Assets
My Assets is your personal image library — open it from the toolbar (the image icon). Upload images once, then reuse them across diagrams. When signed in, assets sync to your account; otherwise they're kept locally in your browser.
Using assets in code
An image node's url can be a full URL or a compact asset path. Assets you own are written in the short form assets/<name> instead of the long storage URL, so the code stays readable.
Naming assets
Rename an asset in My Assets (right-click → Rename, or double-click its name). Names may contain letters, numbers and spaces — no special characters. In code, spaces become hyphens: an asset named picture of my is referenced as assets/picture-of-my.
width/height/size to control the rendered size.Color formats
Every color field — node stroke, color, and edge stroke — accepts:
'#ff0000'. Unquoted, the # starts a comment and the value is lost.Style defaults
When a visual property is omitted, it inherits from the active diagram style:
Validation rules
The editor validates as you type and only re-renders the canvas when the whole document is valid. The main rules:
Nodes
nameis required, non-empty, and unique (within its flow and globally).typemust be one of the eight supported types.- Properties outside a type's allowed set are flagged.
sloppiness∈ {1,2,3,4};stroke_width∈ {0.5,1,2,4};opacity∈ 0–100.color/strokemust be valid color strings.codenodes requirelanguageandtext;imagenodes need aurl(a full URL or anassets/…path).imagewidth,heightandsizemust be positive numbers.
Edges
fromandtoare required and must reference existing node names.width∈ {1,2,3,4};sloppiness∈ {1,2,3,4}.
Template
thememust belightordark;stylemust behandmadeorclean.- Unknown keys (in the template or a flow) are flagged.
Full example
A complete diagram using a template, multiple node types, styled edges, and a subflow. The preview renders the root flow.