Skip to content

Grammar Reference ​

Complete syntax reference for Wireweave DSL.

Basic Syntax ​

Comments ​

wireframe
// Single line comment

/* Multi-line
   comment */

Strings ​

wireframe
"Double quoted string"
'Single quoted string'

Numbers ​

wireframe
100        // Integer
3.14       // Float

Booleans ​

wireframe
true
false

Structure ​

Page ​

wireframe
page [title] [at(x, y)] [modifiers] {
  [children]
}

Examples:

wireframe
page { }
page "Title" { }
page "Title" centered { }
page "Title" at(0, 0) viewport="1280x800" { }

Multiple page blocks in the same .wf file lay out side-by-side on a wireframe canvas. Pages with at(x, y) are pinned to the given canvas coordinates; pages without it auto-flow horizontally with a 64px gap. See Pages — Multiple Pages on a Canvas.

Components ​

wireframe
component_name [label] [modifiers] {
  [children]
}

Examples:

wireframe
card { }
card "Title" { }
card shadow=md border { }
button "Click" primary

Components Reference ​

Layout ​

Components that define page structure.

ComponentDescriptionAttributes
pagePage root containertitle, viewport, device, centered, at, p, gap
headerPage header areap, border, gap, justify, align
mainMain content areap, gap
footerPage footer areap, border, gap
sidebarSidebar areaposition, w, p, gap
sectionSection areatitle, expanded, p, gap
wireframe
page "Dashboard" {
  header { }
  main { }
  footer { }
}

Grid ​

Components for flex layout.

ComponentDescriptionAttributes
rowHorizontal flex containergap, justify, align, wrap, p, m
colVertical container/grid columnspan, sm, md, lg, xl, order, gap, p, w
wireframe
row gap=4 justify=between {
  col span=6 { }
  col span=6 { }
}

Container ​

Components for grouping content.

ComponentDescriptionAttributes
cardCard componenttitle, p, shadow, border, gap
modalModal dialogtitle, w, h, p
drawerDrawer paneltitle, position, p
accordionAccordion paneltitle, p
wireframe
card title="Settings" shadow=md {
  // content
}

modal "Confirm" {
  text "Are you sure?"
  button "OK" primary
}

Text ​

Components for displaying text.

ComponentDescriptionAttributes
textRegular textsize, weight, align, muted, m
titleHeading (h1~h6)level, size, align, m
linkHyperlinkhref, external
wireframe
title "Welcome" level=1
text "Description" muted
link "Learn more" href="/docs"

Input ​

Components for user input.

ComponentDescriptionAttributes
inputInput fieldlabel, type, placeholder, value, disabled, required, icon
textareaMulti-line inputlabel, placeholder, value, rows, disabled
selectDropdown selectlabel, placeholder, value, disabled
checkboxCheckboxlabel, checked, disabled
radioRadio buttonlabel, name, checked, disabled
switchToggle switchlabel, checked, disabled
sliderSliderlabel, min, max, value, step, disabled
buttonButtonprimary, secondary, outline, ghost, danger, size, icon, disabled, loading

Input types: text, email, password, number, tel, url, search, date

wireframe
input "Email" inputType=email placeholder="Enter email"
textarea "Message" rows=4
select "Country" { }
checkbox "Agree" checked
button "Submit" primary
button "Cancel" outline

Display ​

Components for displaying visual elements.

ComponentDescriptionAttributes
imageImagesrc, alt, w, h
placeholderPlaceholderlabel, w, h
avatarAvatarname, src, size
badgeBadgevariant, pill, icon, size
iconIconname, size, muted
dividerDividerm, my, mx
wireframe
image src="/photo.jpg" w=200
avatar "John" size=lg
badge "New" variant=success pill
icon "home" size=md
divider my=4

Data ​

Components for displaying data.

ComponentDescriptionAttributes
tableTablestriped, bordered, hover
listListordered, none, gap
wireframe
table striped hover {
  // columns and rows defined in content
}

list ordered {
  // items
}

Feedback ​

Components for providing feedback to users.

ComponentDescriptionAttributes
alertAlert messagevariant, dismissible, icon
toastToast notificationposition, variant
progressProgress barvalue, max, label, indeterminate
spinnerLoading spinnerlabel, size

Variants: success, warning, danger, info

wireframe
alert "Success!" variant=success
progress value=75 label="Loading..."
spinner size=lg

Overlay ​

Overlay UI components.

ComponentDescriptionAttributes
tooltipTooltipposition
popoverPopovertitle
dropdownDropdown menu-
wireframe
tooltip "Help text" position=top {
  button "?" outline
}

dropdown {
  // items
}

Navigation components.

ComponentDescriptionAttributes
navNavigation menuvertical, gap
tabsTab componentactive
breadcrumbBreadcrumb-
wireframe
nav vertical {
  // nav items
}

tabs active=0 {
  // tab panels
}

breadcrumb {
  // breadcrumb items
}

Attribute Syntax ​

Key-Value Attributes ​

wireframe
component attribute=value
component attribute="string value"

Examples:

wireframe
col span=6
input placeholder="Enter email"
progress value=75

Boolean Attributes ​

wireframe
component attribute   // Sets to true

Examples:

wireframe
button primary        // primary=true
input disabled        // disabled=true
checkbox checked      // checked=true

Spacing System ​

Wireweave uses a spacing token system:

TokenValue
00px
14px
28px
312px
416px
520px
624px
832px
1040px
1248px
wireframe
card p=4          // padding: 16px
row gap=2         // gap: 8px
text mt=6         // margin-top: 24px

Full Example ​

wireframe
page "User Management" centered {
  header border {
    row justify=between align=center {
      title "Admin" level=3
      nav {
        // nav items
      }
      avatar "Admin"
    }
  }

  row {
    sidebar w=200 {
      nav vertical {
        // menu items
      }
    }

    main {
      row justify=between {
        title "Users" level=2
        button "Add User" primary
      }

      card {
        table striped hover {
          // table content
        }
      }

      row justify=center gap=2 {
        button "Previous" secondary
        text "Page 1 of 10"
        button "Next" secondary
      }
    }
  }
}

Released under the MIT License.