DSL Syntax
Wire-DSL is a declarative language for describing wireframes using a simple block-based syntax. This guide covers all syntax elements and rules.
File Structure
Section titled “File Structure”Every .wire file has this basic structure:
project "Project Name" { style { density: "normal" spacing: "md" radius: "md" stroke: "normal" font: "base" }
colors { primary: #3B82F6 accent: #3B82F6 control: #3B82F6 chart: #3B82F6 }
screen ScreenName { layout stack { // content } }}Main Blocks
Section titled “Main Blocks”Project
Section titled “Project”Defines the complete wireframe project.
project "Admin Dashboard" { style { ... } colors { ... } screen UsersList { ... } screen UserDetail { ... }}Properties:
name: Project name (string, required)style: Design tokens configuration (highly recommended)
Style Block
Section titled “Style Block”Configures design tokens for visual consistency across the entire project.
project "App" { style { density: "normal" spacing: "md" radius: "md" stroke: "normal" font: "base" } ...}Style Properties:
| Property | Options | Default | Impact |
|---|---|---|---|
density | "compact", "normal", "comfortable" | "normal" | UI element sizing |
spacing | "xs", "sm", "md", "lg", "xl" | "md" | Default layout gaps |
radius | "none", "sm", "md", "lg", "full" | "md" | Border radius |
stroke | "thin", "normal", "thick" | "normal" | Border width |
font | "sm", "base", "lg" | "base" | Typography scale |
Spacing Values:
"xs": 4px"sm": 8px"md": 16px (default)"lg": 24px"xl": 32px
Density Levels:
"compact": Condensed, space-efficient"normal": Standard, balanced (recommended)"comfortable": Spacious, easy-to-use
Colors Block
Section titled “Colors Block”Defines project-level color tokens.
project "App" { colors { primary: #3B82F6 danger: #EF4444 accent: #2563EB control: #16A34A chart: #F97316 brand: primary }}Rules:
- Block name is
colors(plural) - Entries are
key: value valuecan be:- a hex color (
#RRGGBB) - another color key (alias/chaining), e.g.
brand: primary - a named color identifier (e.g.
blue,red,green)
- a hex color (
Built-in variant keys (for variant props):
primary,secondary,success,warning,danger,info(anderror)
You can override any of them in colors.
Semantic keys:
accent: used byTopbaricon/actions, activeTabs,Stathighlighted value/icon, selectedSidebarMenuitemcontrol: used by selected/enabled states inCheckbox,Radio,Togglechart: used byCharttypesline,area, andbartext: default text color fallback (#000000light,#FFFFFFdark)muted: default muted text color fallback (#64748Blight,#94A3B8dark)
Note:
Charttypepiekeeps a fixed multi-color palette and does not usechartas single fill.
Screen
Section titled “Screen”Defines a screen/page in the wireframe.
screen UsersList { layout split(left: 260, gap: md) { layout stack { ... } // fixed panel layout stack { ... } // flexible panel }}Properties:
id: Unique identifier (derived from screen name)- Must contain exactly one root layout
Screen names must be in CamelCase and unique within the project.
Layouts
Section titled “Layouts”Containers for organizing components hierarchically. There are 5 layout types.
Stack Layout
Section titled “Stack Layout”Linear arrangement of elements vertically or horizontally.
layout stack(direction: vertical, gap: md, padding: lg) { component Heading text: "Title" component Button text: "Action"}Properties:
direction:vertical(default) |horizontalgap: spacing between children (xs/sm/md/lg/xl)padding: internal padding (xs/sm/md/lg/xl; default: none)align: horizontal alignment fordirection: horizontalonlyjustify(default): Equal width, fills 100%left: Natural width, grouped leftcenter: Natural width, centeredright: Natural width, grouped right
Examples:
Horizontal stack with equal width (default):
layout stack(direction: horizontal, gap: md) { component Button text: "Save" component Button text: "Cancel" component Button text: "Delete"}Horizontal stack with right-aligned buttons:
layout stack(direction: horizontal, gap: md, align: "right") { component Button text: "Back" component Button text: "Next" variant: primary}⚠️ Note: Layouts without explicit padding default to 0px (no inheritance from project style).
Grid Layout
Section titled “Grid Layout”12-column flexible grid system for responsive layouts.
layout grid(columns: 12, gap: md) { cell span: 8 { component Input label: "Search" } cell span: 4 align: end { component Button text: "Create" }}Properties:
columns: number of columns (default: 12)gap: spacing between cells
Cell Properties:
span: column span (default: 12)align: alignment within cell (start/center/end)
Split Layout
Section titled “Split Layout”Two-panel layout with one fixed side and one flexible side.
layout split(left: 260, gap: md) { layout stack { component SidebarMenu items: "Home,Users,Settings" }
layout stack { // main content here }}Properties:
left: fixed width for left panel (pixels)right: fixed width for right panel (pixels)background: color token/variant/hex applied to the fixed panelborder:trueadds vertical divider between panelsgap: spacing between panelspadding: inner padding
Rules:
- provide exactly one of
leftorright splitrequires exactly 2 children- legacy
sidebarparameter is deprecated and reported as semantic error
Panel Container
Section titled “Panel Container”Specialized container with automatic padding and border styling.
layout panel(padding: md, background: white) { component Text content: "Panel content"}Properties:
padding: internal padding (xs/sm/md/lg/xl)background: background color (color name or hex)
Card Container
Section titled “Card Container”Flexible vertical container for grouping related content.
layout card(padding: lg, gap: md, radius: md, border: true) { component Image type: landscape component Heading text: "Product Title" component Text content: "Product description" component Button text: "Learn More"}Properties:
padding: internal padding (xs/sm/md/lg/xl; default:md)gap: spacing between children (xs/sm/md/lg/xl; default:md)radius: corner radius (xs/sm/md/lg/xl; default:md)border: show border (true/false; default:true)
Comments
Section titled “Comments”Wire-DSL supports two types of comments:
Line Comments
Section titled “Line Comments”// This is a line commentproject "My App" { // Comments can appear anywhere style { ... }}Block Comments
Section titled “Block Comments”/* Multi-line block comment can span multiple lines and are useful for longer explanations */project "My App" { ... }Both comment types are removed from the compiled output.
Custom Definitions
Section titled “Custom Definitions”Use custom definitions to reuse both components and layout shells.
Define Component
Section titled “Define Component”define Component "MyMenu" { component SidebarMenu items: "Home,Users,Permissions" active: 0}Dynamic properties
Section titled “Dynamic properties”Inside a definition body, values starting with prop_ are dynamic bindings.
define Component "MyMenu" { component SidebarMenu items: "Home,Users,Permissions" active: prop_active}
screen Main { layout stack { component MyMenu active: 1 }}Binding behavior:
- provided arg: value is substituted
- missing arg on optional target: omitted + warning
- missing arg on required target: semantic error
- extra invocation arg not consumed by definition: warning
Define Layout
Section titled “Define Layout”define Layout "screen_default" { layout split(left: prop_left) { component SidebarMenu items: "Home,Users,Permissions" active: prop_active component Children }}Usage:
screen Main { layout screen_default(left: 220, active: 1) { layout stack(gap: md) { component Heading text: "Main Screen" } }}Rules:
define Layoutbody must be exactly one rootlayoutcomponent Childrenis reserved for layout definitions- Every defined layout must contain exactly one
component Children - Every invocation of a defined layout must pass exactly one child block
- Layout names must match
^[a-z][a-z0-9_]*$
Naming recommendations:
define Componentshould use PascalCase (warning if not)define Layoutmust use lowercase-first + lowercase/number/underscore- Prefixes like
screen_default/layout_shellare valid identifiers
Components
Section titled “Components”Individual wireframe elements that appear in layouts.
Syntax
Section titled “Syntax”component <Type> <properties>Example:
component Button text: "Click me" variant: primaryComponent Properties
Section titled “Component Properties”Properties use key: value syntax:
- String values use double quotes:
text: "Hello" - Numeric values without quotes:
height: 200 - Boolean values without quotes:
checked: true - Enum values without quotes:
variant: primary
Complete Example
Section titled “Complete Example”project "Admin Dashboard" { style { device: "desktop" density: "normal" spacing: "md" radius: "md" stroke: "normal" font: "base" }
screen UsersList { layout split(left: 260, gap: md) { layout stack(gap: lg, padding: lg) { component Topbar title: "Dashboard" component SidebarMenu items: "Users,Roles,Permissions,Audit" active: 0 }
layout stack(gap: md, padding: lg) { component Heading text: "Users"
layout grid(columns: 12, gap: md) { cell span: 8 { component Input label: "Search" placeholder: "name, email..." } cell span: 4 align: end { component Button text: "Create User" variant: primary } }
component Table columns: "Name,Email,Status,Role" rows: 8 } } }
screen UserDetail { layout stack(gap: md, padding: lg) { component Breadcrumbs items: "Users,User Detail"
layout grid(columns: 12, gap: md) { cell span: 8 { layout card(padding: lg, gap: md) { component Heading text: "User Profile" component Text content: "Name: John Doe" component Text content: "Email: john@example.com" component Text content: "Role: Administrator" } } cell span: 4 { layout panel(padding: lg) { component Heading text: "Actions" component Button text: "Edit" variant: primary component Button text: "Delete" variant: secondary } } }
component Tabs items: "Permissions,Sessions,Activity" active: 0 } }}Validation Rules
Section titled “Validation Rules”- A
projectmust have at least onescreen - Each
screenmust have exactly one root layout gridlayouts requirecolumnspropertysplitlayouts require exactly one ofleftorrightand exactly 2 childrenTablecomponents requirecolumnsproperty- All identifiers must be unique within project scope
- Property values must match their defined types
define Layoutnames must match^[a-z][a-z0-9_]*$component Childrenis only valid insidedefine Layout- Defined layout declarations and invocations require exactly one
Childrenchild slot prop_*bindings require matching invocation args when target field is required- No absolute positioning allowed
Design Principles
Section titled “Design Principles”- Wireframing First: Focus on structure and layout, not aesthetics
- Composability: Build complex layouts from simple, reusable containers
- Consistency: Use style tokens for unified appearance
- Simplicity: Minimal syntax with maximum expressiveness
- Clarity: Property names match common UI terminology