write_page

Imports a page you write as HTML into frames. HTML is only the way in: after the import you edit the frames, or edit the HTML and import again.

What it does

Wonderblok renders your page in its own web view at each width you ask for, then converts the layout into frames, text, images and auto layout. Semantic tags are kept. Colors and fonts are mapped to the file's tokens: a value that equals a token snaps to it, and any other value takes the nearest token and is reported.

Each frame is upserted by its key, so importing the same page again updates the frame, keeps the ids of keyed layers, and removes layers the page no longer has. The file must be open in the Wonderblok app, and the call needs the guidelines hash like any edit.

Arguments

frame
Required. The name of the frame to create or update.
html
The page's HTML. Give this or path, not both.
path
Instead of html: the path of an .html file.
css
CSS added to the head of the page.
key
A stable key for the frame. It defaults to the frame name as you wrote it.
parent_id
A frame to import into. Leave it out for the top of the board.
board
app (the default) or components.
group
An app board group id for a top-level frame.
width
Viewport width in px, from 200 to 4000. The default is 1440.
widths
Several widths, such as [1440, 390]. You get one frame per width, named like Home · 390, with the key followed by @ and the width, such as Home@390. Each width is 200 to 4000 px, and you can give 1 to 8.
fluid
With widths: true makes one fluid frame that keeps what differs per width.
height
Viewport height in px. Leave it out for the whole page.
root
CSS selector of the element to import. The default is body.
selector
CSS selector of one element, such as a section, to import as the frame, sized to it.
unwrap
true: the root element is the frame. This is for code from get_code.
create_missing
true: make the components the file lacks from their elements.
steps
Steps to run first to reach a state: click, type, scroll or wait.
strict
true: refuse the import if a color or font has no token of its own, or the guidelines lint finds anything.
check
true: compare Wonderblok's render of each frame with the page, as a percent of pixels that differ.
guidelines
The hash from get_guidelines.
file
Optional. The file to import into, by name or path.

What it returns

JSON with a report. Its node.frames lists each frame with its id, key, name and layers count. The report also has snapped, warnings and a guard, which lists the values no token holds (offToken) with their nearest token. With check, each frame gets a differs value such as 0.0%.

Example

Call
write_page {  "guidelines": "9c1e0b7a42d3f860",  "frame": "Home",  "html": "<h1>Hi</h1>",  "check": true}
Reply (formatted, abbreviated)
{  "report": {    "node": { "frames": [{ "id": "…", "key": "Home", "name": "Home", "layers": … , "differs": "…%" }] },    "guard": { "snapped": … },    "snapped": [ … ],    "warnings": [ … ]  }}

Notes

  • Stylesheets, images and fonts load by relative link from a single folder. With html, that is the folder of the .wonderblok file. With path, it is the folder of that HTML file. Links that leave the folder are refused.
  • Fonts that Wonderblok does not ship, fetch or find on the machine draw in a fallback, and the lint says so. To use your own font, put the file in assets/ with put_asset (run through run_tool) and add a set_font op with apply_ops.
  • An element with data-component imports as an instance of that component. Ask read_guide for the topic pages for the rules, including create_missing.
  • For a round trip, call get_code (run through run_tool) with keys: true, edit the HTML, then call write_page with unwrap: true.

Was this page helpful?

Edited Nov 8, 2026