DSL syntax

Complete syntax reference for the Wiremark DSL — the text format for describing UI wireframes.

Root block

Every Wiremark document must start with either wiremarkUI or the short alias ui. This is the root block keyword.

wiremarkUI
  page "My Screen" { }
ui
  page "My Screen" { }

Both are equivalent. wiremarkUI is preferred in documentation for clarity.

import

External stylesheets can be loaded into the SVG output using import before the root block:

import "https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"

wiremarkUI
  page "Home" { }

Only https:// and http:// URLs are accepted. Imports are injected as <link> elements inside the SVG <defs> block.

Pages

Pages are the top-level containers. Every page becomes one frame in the rendered SVG.

Anonymous page (no ID):

wiremarkUI
  page "Dashboard" {
    header "My App"
  }

Named page (with ID for flows and button links):

wiremarkUI
  page HOME "Home" { }
  page ABOUT "About" { }
  HOME --> ABOUT

The ID (HOME, ABOUT) is an uppercase identifier used in flow declarations and button ... link targets. The quoted string is the page title displayed in the frame header.

Components

Components follow this syntax rule:

kind "label" [modifiers] [{ children }]
  • kind — a keyword (button, table, nav, metric, etc.)
  • "label" — an optional quoted string
  • modifiers — optional single-word keywords on the same line (primary, active, disabled, etc.)
  • { children } — an optional block containing child components

Inline (no block):

button "Save" primary
input "Email" error
alert "Something went wrong" error

Block (with children):

form {
  input "Name"
  input "Email"
  button "Submit" primary
}

Named declarations

Components can be declared at the root level (outside any page) with an identifier, then referenced inside any page by that identifier. The resolver replaces the reference with a deep copy of the declaration.

wiremarkUI
  sidebar SD {
    nav "Dashboard" active, "Users", "Settings"
  }

  header H "My App"

  page "Screen A" {
    H
    SD
    text "Content A"
  }

  page "Screen B" {
    H
    SD
    text "Content B"
  }

Declarations must appear before their first use. Any component kind can be declared.

Flow declarations

Flow declarations define navigation order between named pages. They appear at the end of the document, outside any page block.

HOME --> USERS --> DETAIL

Directional arrows:

ArrowDirectionGrid placement
--> or -r->Righttarget placed in next column, same row
-d->Downtarget placed in next row, same column
-u->Uptarget placed in previous row, same column
-l->Lefttarget placed in previous column, same row

Mixed-direction chains are supported:

HOME -r-> USERS -d-> DETAIL

This places USERS to the right of HOME, and DETAIL below USERS.

Modifiers

Modifier words follow the component label on the same line. Multiple modifiers are separated by spaces.

ModifierEffect
primaryFilled blue background (buttons)
disabledReduced opacity, non-interactive appearance
activeHighlighted active state (nav items)
errorRed styling (inputs, alerts)
warningAmber styling (alerts)
infoBlue styling (alerts)
horizontalForces horizontal layout
verticalForces vertical layout
centeredCenters content horizontally
smallSmall variant (icons: 12px)
largeLarge variant (icons: 24px)

Full example

A complete two-page application with a shared sidebar, metric grid, data table, and a right-pointing flow:

Live example Open in editor ↗
Home My App Dashboard Users Reports Settings Search… Export 1,284 Active Users $48,320 Revenue 99.9% Uptime Users My App Dashboard Users Reports Settings Users Name Email Role Status Alice alice@corp.co Admin Active Bob bob@corp.co Viewer Pending Made with Wiremark