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 style 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",
"style": {
"density": "normal",
"spacing": "md",
"radius": "md",
"stroke": "normal",
"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
styleobjectNoStyle tokens (engine defaults applied if omitted)
screensarrayYesScreen definitions (at least 1)
nodesobjectYesAll nodes referenced by screens
FieldTypeValuesDescription
densitystringcompact, normal, comfortableUI compactness
spacingstringxs, sm, md, lg, xlBase spacing token
radiusstringnone, sm, md, lg, fullBorder radius token
strokestringthin, normal, thickBorder width token
fontstringsm, base, lgTypography scale token
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, component, or instance
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

Produced when a define Component or define Layout is used in a screen. Wraps the expanded content and preserves the call-site identity for canvas interaction.

{
"id": "node_12",
"kind": "instance",
"definitionName": "MyComp",
"definitionKind": "component",
"invocationProps": { "text": "Hello" },
"expandedRoot": { "ref": "node_11" },
"style": {},
"meta": { "nodeId": "component-mycomp-0" }
}
FieldTypeDescription
idstringUnique node ID
kindstringAlways instance
definitionNamestringName of the user-defined component/layout
definitionKindstringcomponent or layout
invocationPropsobjectProps provided at the call site (editable by canvas)
expandedRootrefRoot node of the expanded definition content
meta.nodeIdstringSourceMap nodeId of the call-site (mapped to SVG data-node-id)

Internal nodes inside the expansion have scoped IDs (definitionNodeId@callSiteNodeId) to ensure uniqueness when the same component is used multiple times.

{
"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": "md",
"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",
"style": {
"density": "normal",
"spacing": "md",
"radius": "md",
"stroke": "normal",
"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:

  • 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: