Skip to content

IR Format Specification

The IR (Intermediate Representation) is a stable, versioned JSON format that represents wireframes in normalized form after parsing and validation.

The IR transforms raw DSL into an unambiguous, renderable format:

  • Input: Parsed .wire file (AST)
  • Processing: Apply theme defaults, validate components, normalize values
  • Output: Complete IR document ready for layout and rendering
  • Deterministic: Same input always produces same output
  • Versioned: Allows for schema migrations (currently v1.0)
  • Normalized: All defaults applied, all values validated
  • Cross-referenceable: Nodes stored in dictionary for easy lookup
  • AI-friendly: Regular, predictable structure
{
"irVersion": "1.0",
"project": {
"id": "proj_dashboard",
"name": "Admin Dashboard",
"theme": {
"density": "normal",
"spacing": 16,
"radius": 4,
"stroke": 2,
"font": "base"
},
"screens": [
{
"id": "screen_dashboard",
"name": "Dashboard",
"viewport": { "width": 1280, "height": 720 },
"root": { "ref": "node_root_1" }
}
],
"nodes": {
"node_root_1": {
"id": "node_root_1",
"kind": "container",
"type": "stack",
"children": [ ... ]
}
}
}
}
FieldTypeRequiredDescription
idstringYesUnique project identifier
namestringYesHuman-readable name
themeobjectNoTheme tokens (defaults applied if omitted)
screensarrayYesScreen definitions (at least 1)
nodesobjectYesAll nodes referenced by screens
FieldTypeValuesDescription
densitystringcompact, normal, comfortableUI compactness
spacingnumber4, 8, 16, 24, 32Base spacing in pixels
radiusnumber0, 2, 4, 8Border radius in pixels
strokenumber1, 2Border width in pixels
fontstringbase, title, monoTypography family
FieldTypeRequiredDescription
idstringYesUnique screen identifier
namestringYesHuman-readable name
viewportobjectYesDisplay dimensions {width, height}
rootrefYesReference to root layout node
{
"id": "node_stack_1",
"kind": "container",
"type": "stack",
"properties": {
"direction": "vertical",
"gap": 16,
"padding": 24,
"align": "justify"
},
"children": [
{ "ref": "node_heading_1" },
{ "ref": "node_input_1" }
]
}
FieldTypeDescription
idstringUnique node ID
kindstringcontainer or component
typestringLayout/component type
propertiesobjectType-specific properties
childrenarrayChild node references (containers only)
{
"id": "node_button_1",
"kind": "component",
"type": "Button",
"properties": {
"text": "Submit",
"variant": "primary"
}
}
FieldTypeDescription
idstringUnique node ID
kindstringAlways component
typestringComponent name (e.g., Button, Input)
propertiesobjectComponent-specific properties
{
"type": "stack",
"properties": {
"direction": "vertical" | "horizontal",
"gap": 16,
"padding": 24,
"align": "justify" | "left" | "center" | "right"
}
}
{
"type": "grid",
"properties": {
"columns": 12,
"gap": 16
},
"children": [
{
"ref": "cell_1",
"span": 6,
"align": "start" | "center" | "end"
}
]
}
{
"type": "split",
"properties": {
"sidebarWidth": 260,
"gap": 16
},
"children": [
{ "ref": "sidebar_node" },
{ "ref": "content_node" }
]
}
{
"type": "panel",
"properties": {
"padding": 16,
"background": "white"
},
"children": [{ "ref": "content_node" }]
}
{
"type": "card",
"properties": {
"padding": 16,
"gap": 16,
"radius": 4,
"border": true
},
"children": [ ... ]
}

Components store properties specific to their type:

{
"id": "node_input_1",
"kind": "component",
"type": "Input",
"properties": {
"label": "Email",
"placeholder": "your@email.com"
}
}

See Components Reference for all property options.

{
"irVersion": "1.0",
"project": {
"id": "proj_login",
"name": "Login",
"theme": {
"density": "normal",
"spacing": 16,
"radius": 4,
"stroke": 2,
"font": "base"
},
"screens": [{
"id": "screen_login",
"name": "Login Screen",
"viewport": { "width": 400, "height": 500 },
"root": { "ref": "stack_root" }
}],
"nodes": {
"stack_root": {
"id": "stack_root",
"kind": "container",
"type": "stack",
"properties": {
"direction": "vertical",
"gap": 16,
"padding": 24
},
"children": [
{ "ref": "heading_title" },
{ "ref": "input_email" },
{ "ref": "input_password" },
{ "ref": "button_login" }
]
},
"heading_title": {
"id": "heading_title",
"kind": "component",
"type": "Heading",
"properties": { "text": "Sign In" }
},
"input_email": {
"id": "input_email",
"kind": "component",
"type": "Input",
"properties": {
"label": "Email",
"placeholder": "you@example.com"
}
},
"input_password": {
"id": "input_password",
"kind": "component",
"type": "Input",
"properties": {
"label": "Password",
"placeholder": "••••••••"
}
},
"button_login": {
"id": "button_login",
"kind": "component",
"type": "Button",
"properties": {
"text": "Login",
"variant": "primary"
}
}
}
}
}

All IR documents are validated against a Zod schema:

  • Theme properties must exist and have valid values
  • Screen viewports must be positive integers
  • All node references must exist in the nodes dictionary
  • All component properties must be valid for that component type
  • Layout children references must exist

Invalid IR produces detailed validation errors.

For complete technical specification with all property definitions, see: