Visual editor
The editor shows the source and the diagram side by side. Changes in either one update the other.
- Online: open the editor. Diagrams are kept in local storage. Share copies a link with the source in the URL, and with every file when there are several.
- Local files:
yuhwa edit diagram.yustarts a local server, opens the editor and saves back into the file.yuhwa edit README.md --block 1edits the second diagram in a Markdown file.
Every diagram on this site has an Open in editor link in its corner.
Files
The tabs above the source are files. One diagram can be split over them with import, exactly as on disk:
- + adds a file. Double-click a tab to rename it. Imports in the other files follow the new name.
- × on a tab deletes the file. The last file can not be deleted.
- Each file keeps its own undo history.
- The canvas always shows the current tab, with its imports resolved from the other tabs.
- Each tab renders with its own settings. A
theme:in one file does not change the others;export theme: ...in a shared file does, for every file that imports it. The toolbar's theme picker edits the current file. - Templates with several files open every file as a tab. The Shop platform template splits styles, components and the page.
yuhwa edit main.yuloads every file it imports as a tab. Saving writes each changed tab back to its file on disk.
// shared.yu
.svc [blue]
api "API" .svc
// main.yu
import "./shared.yu"
web "Web" .svc -> apiInsert
The Add menu inserts a ready block with a free id: sequence, timeline, charts, git history, a node, a group, a class or a card. Panel kinds from your own plugins are listed too. Under Import a file it adds an import line for each other tab. The new block is selected, so typing replaces it.
Blocks go in before the layout { } block, imports at the top.
Adding and deleting
- Double-click the empty canvas to add a node there. Its label opens for typing right away.
- Select a box and press + Connected node under Connect for a new box with an edge from the selected one. A box inside a group gets its new neighbour in the same group. connect to draws an edge to any other box.
- Select a group and press + Node inside to add a box to it.
- Delete in the sidebar title, or Delete / Backspace, removes the selection from the source. A box goes with its props, its body and the lines of its edges. A group is unwrapped: its members stay. A panel goes with its whole block. The editor refuses when the element shares a line it can't be cut from, such as a chain
a -> b -> c; edit the source then.
Import
Import opens a dialog for Mermaid, JSON or yuhwa. Paste the text, pick a file, or drop a file anywhere on the editor. With as a new file checked, the result opens in a new tab. Otherwise it replaces the current file. Conversion warnings show in the status bar. See From Mermaid or JSON for what converts.
Moving things
- Drag a box, a group or a panel to move it. Moves snap to the dot grid on the canvas (12 units). A box snaps by its centre, so boxes on one grid line share it and the edges between them run straight. Hold Alt to move freely. Arrow keys nudge the selection by 1, with Shift by one grid step.
- Drag the corner handle of a selected box to resize it. A selected panel has one too: it writes the panel's
widthandheight, the smallest frame size. Double-click it to drop both. - Drag an edge to bend it. This adds a waypoint. Right-click or double-click a waypoint to remove it. Right-click a bent edge to remove all its waypoints.
- Drag an edge end to another side of its box to change the port.
- Drag an edge label to move it. Reset route in the sidebar puts it back.
- Select a panel to see its handles, when its kind has any. A git history has one per lane, commit and branch line, a sequence one per participant and row, a timeline one per event and a chart one to resize it. Drag a handle to move that part. Dragging a quadrant point edits its coordinates on the existing point line; Undo restores the previous values. Double-click a layout handle to reset its offset. The sidebar sets panel options such as
direction,numberedortype, pluscolorandframe, and Reset layout there clears every nudge of that panel.
Editing text
Double-click a box, an edge, an edge label, a group or a panel to edit its label in place. Enter saves, Esc cancels. The sidebar has the same text as a label field (title for panels). Write \n for a line break. An empty label removes it from the source: a box or group then shows its id again. The text is written into the source, quoted where needed. Every edge of one line (a -> b, c: label) shares that line's label.
Styling
The sidebar on the right shows every option for the current selection, grouped into sections. With nothing selected it edits the diagram settings: title, theme, accent, background, font, direction, gaps and panel arrangement. The font field suggests the fonts on your computer and says which font of a fallback list it shows. The canvas lays out again when a web font finishes loading.
Select a node, edge or group to edit its text, colours, shape, line style, arrow heads, sides and size. Nodes, edges, groups and panels share the same text fields: text colour, font size, font weight and italic. They write the text props; for a panel, font size scales all its text. To style only part of a label, write a style span such as {red, size: 18 | part} in the label field. Every colour has a picker: the palette dots, a striped dot for the default and a rainbow dot for any custom colour, written as #hex. Fill, stroke and text colours also take typed values such as blue-600 or tomato.
Select a panel to edit its title, options, size, colour and frame. Hover or focus the ⓘ next to an option to read what it does. Click a section title to fold it; the editor remembers which sections are folded. Parts lists its events, items, participants, messages, notes, tasks, branches, commits, columns or cards. Click one to open it: a colour picker, plus the fields and actions its panel kind offers. A kanban card can change its text, column, owner, ticket and priority, and move up or down; a column can be renamed, take a WIP limit and get a new card with + card. + column under the list adds a column. The part stays open after a move or rename. This works when the panel body is on its own lines.
Each change is written into the source as a prop, so the source stays readable.
The toolbar has three groups: New (a template), Add (a snippet) and Import; the diagram's theme, flow direction and edge curve; and undo, redo and reset layout. Export on the right copies SVG or Markdown, or downloads SVG or PNG. Share copies a link.
| key | action |
|---|---|
| ⌘S | save (local file mode) |
| ⌘Z / ⇧⌘Z | undo / redo |
| Esc | clear the selection |
| Delete | delete the selection |
Where positions go
Manual positions are written into a layout block at the end of the source:
a "Client" -> b "Server": HTTPS
layout {
a at 40 40
b at 280 140 size 140 56
a->b via 200 168 ports right left label 0 -14
}The rest of the file stays as you wrote it. Delete the block, or press Reset layout, to go back to auto-layout. The layout block reference lists every option.
Known limitations
- Long back edges (pointing against the flow) can loop around the diagram. Bend them by hand or set
exit/enterports. - Edge props in the sidebar apply to every edge declared on the same source line, because they share one prop list.
- Nodes made by a component call or a variable come from one line. Styling one in the sidebar adds an
id [props]line below instead of editing the component. - The first drag pins every node, so the rest of the layout cannot shift. Press Reset layout to release them all.