Language Reference
FractalForm diagrams are plain-text scripts for animated system diagrams.
client -> api: GET /usersEdges and state updates create components automatically. Add stages, notes, overlays, artifacts, playback directives, and control blocks only when the diagram needs them.
Quick Reference
Minimal syntax for each FractalForm construct.
component api "API" api -> db api: Ready group "Backend"
component api
end api -> user: issue %token component api
pairs:
status: ok
list:
- validates input
- returns response
end component api shape:database style:#warning icon:check,#success
text style:#7c3aed: Label circle "Label" text "Callout" icon tree "Routing" shape:decision style:separate-edges
- Request
- Valid?
-- yes
- Route
-- no
- Reject
end # stage: Send request
client -> api
# stage: Store result
api -> db # note: Explain next action
api -> db # overlay pause: Five minutes later
api -> db component api
callout @api "Public endpoint" api: Status: OPEN
emphasis @api shape:circle match:"OPEN" --speed 5
api -> db
--wait 1s
db -> api block refresh
api -> cache
end
@refresh
@refresh
@refresh repeat 3
api -> db
end parallel
api -> db
api -> cache
end $count: 0
$count++
api: $count Backend
- api Components
Components represent the parts of a system, such as services, databases, people, or external tools. They can be labeled, styled, tagged, and organized into groups. Components also appear automatically when used in a connection or state update.
Syntax
component key "Display Name" shape:shape multi:stack style::tierN,utilities,#color icon:name,badge [tags]component key "Display Name"
Initial body
end Details
| Parameter | Description | Example |
|---|---|---|
| key | Addressable identifier. | |
| "Display Name" | Quoted label. | |
| shape:shape multi:stack | Structural shape and multiplicity. | |
| Shapes | default, circle, database, hexagon, diamond, note, actor, icon, cloud, external, browser, server, funnel, code. | |
| style::tierN,utilities,#color | Component preset, direct style overrides, icon title visibility, and outline color. | |
| many | Render one logical component as a stacked or repeated visual. | |
| #color | Theme color token or hex color for visual emphasis. | |
| icon:name,badge | Icon or badge metadata. | |
| [tags] | Short visual metadata; tags can carry colors. | |
| Initial body | Indented body under component ... end. Plain text becomes markdown; decorator bodies become structured content. Last declaration wins. | |
Examples
Component Declaration
# Declarations set labels, shapes, icons, and tags.
component api "API" shape:server style::tier1 icon:server,badge [backend]
component db "Database" shape:database icon:database,badge
api -> db: queryEdges
Edges show relationships and movement between parts of a system. Arrow edges play as activity in the timeline, while static edges remain visible without playing. Branches connect one source to several destinations, and paths are visual guides only.
Syntax
source -> target: labeledge from:source to:target "label"edge from:source to:target
label
endbranch routes from:source to:[left,right] marker:arrowpath guide "Guide" from:source to:target style:stroke-dashedsource -> middle -> target: labelsource -> [target-a, target-b]: labelsource -> target mark:dropped,#error: label Details
| Arrow | Meaning |
|---|---|
| -> | Synchronous call |
| ->> | Async fire-and-forget |
| ~> | Streaming |
| --> | Optional or conditional |
| -->> | Async optional or conditional |
| ..> | Inferred or weak |
| ..>> | Async inferred or weak |
| <-> | Bidirectional |
| <~> | Bidirectional streaming |
| <--> | Bidirectional optional or conditional |
| <..> | Bidirectional inferred or weak |
| branch | Static shared stem with addressable source and destinations. |
| path | Visual-only path; does not create replay events or topology edges. |
Examples
Basic Edges
# Plain edges create components if needed.
client -> api: request
api -> db: queryState
State is the information a component displays as the diagram plays. It can be simple text, Markdown, or structured content, and each update replaces what the component currently shows. A component body defines what appears before playback.
Syntax
component: contentstate component: contentstate component
Markdown body
endcomponent:
Markdown bodycomponent:
pairs:
status: okcomponent mark:destroyed: contentcomponent <mark:destroyed>: content Details
| Form | Description | Example |
|---|---|---|
| Text | Simple replay status. | |
| Keyword state | Explicit replay alternative to inline key:. | |
| Structured | Decorated state body. | |
| Markdown body | Indented Markdown after a state opener. | |
| Timeline mark | Transient node treatment. | |
Examples
Component State
# Inline state updates change what a component displays during replay.
api: Processing request
api:
pairs:
status: ok
count: 3
api:
Handles *requests*.
- validates inputGroups
Groups organize related parts of a diagram inside a shared visual boundary. They can contain components, text, trees, and other groups.
Syntax
group key "Display Name" shape:shape style:stroke,radius-12px,title-hidden,#color icon:name [tags]
component key
endgroup "Display Name"
existing-key
end Details
| Part | Description | Example |
|---|---|---|
| key | Optional addressable identifier; quoted-only groups get an internal key. | |
| "Display Name" | Visible group label. | |
| shape | Border geometry: rect, circle, diamond, hex, or ellipse. | |
| stroke | Border stroke: solid, dashed, or dotted. | |
| radius | Boundary corner radius in pixels. | |
| title-hidden | Hide the title bar without removing the group label or identity. | |
| #color | Theme color token for the border. | |
| icon:name | Optional group icon and color. | |
Examples
Group Block
# Group related components under one boundary.
group backend "Backend"
component api "API" shape:server
component db "Database" shape:database
end
api -> db: queryArtifacts
Artifacts represent data that moves through a system, such as a file, token, request, or result. They have their own identity and state, can travel along edges, and can be cleared independently.
Syntax
artifact key "Name" icon:namesource -> target: label %artifact%artifact:
Markdown body%artifact:
pairs:
status: ok%artifact#copy Details
| Feature | Syntax |
|---|---|
| Declare | artifact token "Token" icon:key-round |
| No declaration | client -> api: upload %file |
| Attach to edge | auth -> user: issue %token |
| Instance copy | %item#copy |
| Multiple | api -> client: done %order %receipt |
| Markdown state | %token: Token issued |
| State | %token: pairs: sub: user123 |
| Clear | --clear %token |
Examples
Declared Artifact
# Artifacts are data objects with identity.
artifact token "Token" icon:key-round
auth -> user: issue %token
%token:
pairs:
sub: user123
exp: 15m
user -> api: GET /profile %tokenContent Rendering
Indented bodies can render as Markdown or as decorated content. The same body forms work in component state, artifact state, attached or standalone text, and shape bodies. Decorated bodies use a small YAML-like syntax.
Markdown Bodies
A body with plain indented text renders as Markdown. Use this for prose, lists, headings, emphasis, code spans, and inline icons.
| Where | Structure | Body |
|---|---|---|
| Component state | | Markdown rendered in the component body. |
| Artifact state | | Markdown rendered on the artifact. |
| Standalone text | | Markdown rendered as free canvas text. |
| Attached text | | Markdown rendered beside the target. |
| Shape body | | Markdown rendered inside the shape. |
Decorator Bodies
A body whose first content line is a decorator uses that decorator to choose the rendered shape. Decorators can be combined in the same body.
| Decorator | Structure | Body |
|---|---|---|
| text: | | Plain text content. |
| pairs: | | Mapping rendered as labeled rows. |
| list: | | Sequence rendered as bullets. |
| list:ordered: | | Sequence rendered as numbered steps. |
| list:segmented: | | Sequence rendered as adjacent cells on one unwrapped row. |
| group:panel: | | Panel groups contain decorated blocks in a collapsible section. |
| table: | | Sequence of mappings rendered as table rows. |
| table:grid: | | Sequence of mappings rendered with an outer border and row and column dividers. |
| error: | | Mapping rendered with error styling. |
| group: | | A group contains other decorated content blocks. |
| markdown: | | Markdown body inside decorated content. |
| json: | | JSON code body after a state opener. |
Examples
Text
The text decorator renders plain component content.
component api "Text"
api:
text: ReadyColors
Colors help distinguish status, meaning, and related parts of a diagram. Named colors adjust to the current theme, while hex colors stay exactly as written.
Syntax
#success#error#warning#info#red #blue #green #yellow #purple #gray #orange #pink #cyan #primary #secondary#gray-50 #gray-100 #gray-200 ... #gray-900 #gray-950#abc #7c3aed #7c3aedff Details
| Token | Visual | Use |
|---|---|---|
| #success | Green | Successful, healthy, complete, accepted. |
| #error | Red | Failed, blocked, rejected, unavailable. |
| #warning | Amber or orange | Risk, degraded, retry, needs attention. |
| #info | Blue | Neutral status, context, informational callout. |
| #primary | Theme accent | Primary emphasis aligned with the active theme. |
| #secondary | Muted | Subtle metadata or secondary visual weight. |
| #red, #blue, ... | Named palette color | Non-semantic grouping. |
| #gray-50 … #gray-950 | Neutral gray scale | Theme-independent neutral contrast. |
| #abc, #7c3aed, #7c3aedff | Exact hex color | One-off brand or diagram-specific accents. |
Examples
Semantic Color Tokens
# Semantic colors carry meaning and follow the active theme.
component api "API" shape:server style:#info icon:server,#info [public #info]
component worker "Worker" shape:hexagon style:#warning icon:cpu,#warning [retry #warning]
component db "Database" shape:database style:#success icon:database,#success [healthy #success]
api -> worker: retry <icon:alert-triangle #warning>
worker -> db mark:#success: write <icon:check #success>
worker -> api mark:dropped,#error: timeout <icon:x #error>
# note pause #warning: Retry is safe, but it needs attention.
api -> worker: retry againShapes
Shapes add simple visual elements such as circles, rectangles, and diamonds to the canvas. They can be labeled, styled, and attached to other elements, but they are canvas elements rather than system components.
Syntax
circle "Label"rect id style:stroke-dashed,#colorellipse id @target style:#warning "Label"diamond id:
Markdown bodydiamond id:
pairs:
status: ok Details
| Part | Description | Example |
|---|---|---|
| primitive | Primitive element command. | |
| Primitive | Canvas geometry: rect, circle, diamond, ellipse, hex, or line. | |
| id | Optional stable identifier; omitted shapes get generated ids. | |
| @target | Optional attachment target for relative placement. | |
| style modifiers | Stroke, direction, size, and color metadata. | |
| Label/body | Quoted inline label or indented body after a colon. | |
| Decorated body | Shape body rendered with a content decorator. | |
Examples
Circle Shape
circle "Label"Text
Text adds explanations and labels to the canvas. It can stand on its own or attach to a component, group, or other element.
Syntax
text "Display Text"text display-text "Display Text"
view
text:display-text: text-style:font-size-24px,weight-700
endtext @target |
Markdown bodytext @target marker:|
Markdown bodytext @target |
pairs:
status: oktext @target style:#info ->
Markdown body Details
| Form | Description | Example |
|---|---|---|
| Standalone | Free-floating annotation. | |
| Attached | Sidecar beside a target. | |
| : | Plain markdown body. | |
| Decorated body | Body rendered with a content decorator. | |
| | | Guide bar beside the text. | |
| ] | Bracket marker. | |
| } | Brace marker. | |
| -> / <- | Arrow connector direction. | |
| -o / o- | Step connector direction. | |
| marker: | Property form for the same marker options. | |
| Style | Standalone size/opacity, or attached description presentation metadata. | |
Examples
Standalone Text
text "Request Flow"Icons
Icons add standalone symbols to the canvas. Like shapes, they are visual elements rather than system components; a component can also be displayed as an icon.
Syntax
icon icon statusicon api "API"icon @target status style:#successicon swarm multi:swarm style:#infoicon job-clock @workericon ingest-progress Details
| Part | Description | Example |
|---|---|---|
| icon name | Create a standalone canvas icon. | |
| id | Optional stable identifier for addressing or view metadata. | |
| "title" | Optional single-line title rendered below the icon. | |
| @target | Attach the icon relative to another element. | |
| multi:swarm | Render the icon as a repeated visual. | |
| motion-* | Use a registered replay-clock animation on a standalone icon primitive. | |
| {icon} | Quick Notation icon primitive. | |
| {{icon}} | Quick Notation repeated icon primitive. | |
| shape:icon | Create a topology component rendered as an icon. | |
Examples
Icon Primitive
component api "API" shape:server
icon @api status "Healthy" style:#success
icon swarm multi:swarm style:#infoTrees
Trees show branching structures such as decisions, states, and outcomes. They can remain purely visual or have an ID so their branches and scenarios can be referenced elsewhere in the diagram.
Syntax
tree flow "Title" shape:decision style:separate-edges
- State (state)
-- event
- Next (next)
endtree flow "Title" shape:decision style:separate-edges
- Decision? (decision)
-- yes
- Continue (next)
endtree mytree "Title" shape:decision style:separate-edges
- State (state)
-- event
- Next (next)
scenario advance: state -> next
end
@mytree advance Details
| Form | Use For | Example |
|---|---|---|
| tree [id] ["Title"] shape:decision style:separate-edges | Declare a decision tree; ID and title are optional. | |
| shape:decision style:separate-edges | Use diamond decisions with independent left/right exits. | |
| - label | A visible node or branch. | |
| -- outcome | A connector label directly below a decision node. | |
| -> id "Label" | Reference another tree node. | |
| tree.branch | Address a generated branch endpoint from other constructs. | |
| scenario name: a -> b | A validated route inside an addressable decision tree. | |
| @tree scenario | Replay a named route as ordinary sends. | |
Examples
Flowchart Decision
# Flowchart outcomes alternate across native left/right exits.
tree routing "Request routing" shape:decision style:separate-edges
- Authenticated? (auth)
-- yes
- Route request (route)
-- no
- Reject request (reject)
endStages
Stages divide a diagram into chapters that can be played separately. Each stage appears as a clickable link on the canvas and includes the events after its heading up to the next stage. A stage can also include a short description.
Syntax
# stage: Title# Description line Examples
Stage
# stage: Send request
client -> api
# stage: Store result
api -> dbNotes
Notes add context to a specific moment in the timeline. They appear before the next event and can pause playback, dismiss automatically, or show an action number.
Syntax
# note: Text# note pause: Text# note n 5s #warning: Text Details
| Modifier | Effect |
|---|---|
| pause | Manual advance required. |
| 3s | Auto-dismiss after duration. |
| n | Next action number. |
| #warning | Accent color. |
Examples
Basic Note
# Notes explain the next event.
# note: Client sends the request.
client -> api: requestOverlays
Overlays display a message across the canvas during playback. They mark transitions, time jumps, and changes that affect the whole scene.
Syntax
# overlay: Text# overlay pause: Text# overlay 10s: Text Details
| Modifier | Effect |
|---|---|
| pause | Manual advance required. |
| 10s | Auto-dismiss after duration. |
| <icon:name #color> | Optional icon and accent. |
Examples
Basic Overlay
# Overlays narrate scene changes.
# overlay: Explain the next scene.
client -> api: startCallouts & Emphasis
Callouts place lasting explanatory text on the canvas. Emphasis draws attention to a component, part of a component, or matching text.
Syntax
callout @target "Text"callout explanation @api style:#warning:
Text--play explanationemphasis @target match:"Text" style:#warningemphasis @api shape:circle match:"Text"--clear api:emphasis Details
| Form | Effect |
|---|---|
| callout [id] [@target] | Add persistent explanatory text, optionally anchored to a target. |
| --play callout-id [Nx] | Replay an addressable callout’s text, underline, and pointer without changing visibility; an optional multiplier changes draw speed. |
| emphasis @target | Mark the target or matching rendered content. |
| shape:highlight | Highlight matching content; this is the default. |
| shape:circle | Circle matching content. |
| shape:underline | Underline matching content. |
| match:"Text" | Limit emphasis to exact case-insensitive matches. |
| --clear target:emphasis | Remove emphasis from the target. |
Examples
Canvas Callout
component api "API" shape:server
callout @api style:#info:
Public entry point for client requests.Playback Directives
Playback directives control how a diagram changes over time. They can change visibility or activity, clear elements, adjust timing and speed, and number actions.
Syntax
--dim target--show target--hide target--outline target--play target 2x--pause target--clear target--clear target:emphasis--wait 1s--travel 1s--dwell 1s--gap 200ms--speed 5--autonumber Details
| Directive | Effect |
|---|---|
| --dim | Dim elements; motion icons freeze on the current frame. |
| --show | Restore elements; playing motion resumes, while paused motion remains frozen. |
| --hide | Remove elements; motion icons reset to phase zero without changing activity intent. |
| --outline | Show a ghost outline; motion icons freeze. |
| --play | Start or resume an animated icon, which is paused by default. Add a positive multiplier such as 2x or 0.5x to set its speed; omit targets to play all animated icons. |
| --pause | Pause an animated icon; omit targets to pause all animated icons. |
| --clear | Clear targets broadly, or use target:emphasis to clear emphasis only. |
| --wait | Insert a delay. |
| --travel | Set edge traversal duration. |
| --dwell | Set readable dwell for state and artifacts. |
| --gap | Set rest after each event. |
| --speed | Set or reset playback speed. |
| --autonumber | Add action badges. |
Examples
Dim
component api "API" shape:server
api: ready
--dim apiControl Blocks
Control blocks organize sequences of events that repeat, run together, or are reused. They can also represent background activity that continues while the main timeline plays.
Syntax
repeat 3
...
endparallel
...
endblock name
...
end@name*repeat name
...
end--detach @name--attach @name Details
| Block | Effect |
|---|---|
| repeat | Loop a command sequence. |
| parallel | Run commands concurrently. |
| block | Define a reusable command group. |
| @name | Invoke a block. |
| *block / *repeat | Start a detached block or repeating background lane. |
| --detach / --attach | Run a block in the background or wait for it. |
| * @name / ^name | Shorthand detach and attach forms. |
Examples
Repeat
# Repeat loops the body.
repeat 3
client -> api: poll
endVariables
Variables hold values that change as a diagram plays, such as a counter or status. Their values can appear in component state, text, and shapes. They are designed for illustration, not general-purpose programming.
Syntax
$name: value$name:
Markdown body$name:
pairs:
status: ok$name.field: value$name.field++$name.field--text label:
$namerect status:
$name.pairscomponent:
pairs:
field: $name.field Details
| Form | Effect |
|---|---|
| $breaker: value | Set a variable. |
| $breaker.field: value | Set a field. |
| $breaker.field++ | Increment a field. |
| $breaker.field-- | Decrement a field. |
| $count++ / $count-- | Increment or decrement a scalar variable. |
| text label: $summary | Materialize a variable as standalone text content. |
| rect status: $summary.pairs | Materialize a decorated variable path as primitive content. |
| $summary: pairs: status: ok | Set a variable with a decorated body. |
| component: pairs: field: $breaker.field | Render a variable read in a decorated body. |
Examples
Declare Variable
# Variables help illustrate values that change over time.
$breaker: {
status: closed,
failures: 0
}Quick Notation
Quick Notation is a shorter, indentation-based way to describe a FractalForm diagram. It covers common components, groups, and flows while allowing regular FractalForm syntax for more advanced behavior.
Syntax
// Groups are bare labels; indentation creates nesting
Platform (platform) ~#blue
Services
API (api) - // Component and icon primitive marker families
[] Service (service)
Workers (workers)
Database (db)
Gateway (gateway)
@service (status)
(swarm)
Agent (agent)// Child and related components
[] Parent (parent)
- Child
-- Related
fractalform.io
-- /share// > is the Quick Notation replay shorthand
client > api > db: query
edge from:api to:db "static label"// Initial content and attached descriptions
[] API (api)
: Ready
/ Handles requests
| Public endpoint// Canvas text, primitive shapes, and paths
/ Request flow ~#info
[.] Boundary (boundary) ~opacity-75
(.) Cache
<.> Region
<<.>> Decision
((.)) Pool
path divider "Divider" ~#gray// Stages, notes, and overlays
/// Request flow
Follow the request from ingress to storage.
## Validate input ..
Five minutes later 5s..// Indentation closes blocks; do not write end
repeat 3
client > api: retry
parallel
api > db
api > cache// Named and detached blocks also close on dedent
block healthcheck
api > db: ping
*repeat heartbeat
monitor > api: GET /health// Addressable decision tree
?tree retry-policy "Retry policy" =decision ~separate-edges
- Closed (closed)
-- failure
- Open (open) Details
| Quick Form | Converts To |
|---|---|
| Label | group "Label" |
| Label (id) | group id "Label" |
| - api | component api |
| [] API (api) | component api "API" |
| [,browser] Web | component web "Web" shape:browser |
| [,text] /share | component share "/share" shape:text |
| [globe,browser] Web | component web "Web" shape:browser icon:globe |
| [[cpu,server] ] Workers | component workers "Workers" shape:server multi:stack icon:cpu |
| (postgresql) DB | component db "DB" shape:database icon:postgresql |
| <shield> Gateway | component gateway "Gateway" shape:hexagon icon:shield |
| {check} @api (status) | icon check @api status |
| {{check} } (statuses) | icon check statuses multi:swarm |
| [bot,icon] Agent | component agent "Agent" shape:icon icon:bot |
| [[cloud,server] ] API (api) ~:tier1,#info -#warning | component api "API" shape:server multi:stack style::tier1,#info icon:cloud,#warning |
| Platform =circle ~stroke-dashed,radius-12px,title-hidden | group "Platform" shape:circle style:stroke-dashed,radius-12px,title-hidden |
| [] API -icon:server,badge,#warning | component api "API" icon:server,badge,#warning |
| - Child / -- Related | component parent.child / parent..related |
| A>B>C: call | A -> B -> C: call |
| edge from:A to:B "static" | edge from:A to:B "static" |
| : Ready under [] API | initial component body |
| / or | under [] API | attached text description |
| [.] Label (id) ~opacity-75 | named styled primitive |
| (.) / <.> / <<.>> / ((.)) | circle / hex / diamond / ellipse primitive |
| /// Stage | # stage: Stage |
| ## n. Note | # note n: Note |
| ### Overlay 10s.. | # overlay 10s: Overlay |
| repeat / parallel + indentation | block closed by dedent |
| block / *repeat + indentation | named / detached block closed by dedent |
| ?tree [routing] ["Title"] =decision ~separate-edges | decision tree; add an ID only for targeting or scenarios |
Examples
Outline
Backend
- api
- worker
DBgroup "Backend"
component api
component worker
component db "DB" shape:database icon:postgresql
end