Export and design-to-code
On this page2 sections
Exports
kimo_export {docId, target, ids:[…], outDir} exports the given nodes (default: the page's
top-level frames).
pngwrites one<nodeId>.pngper node (scale, default 2).kimowrites the subtrees as a standalone.kimowith the variables they use. Both needoutDir.- Code and token targets:
react-tailwind(<Root>.tsxpages, one<Component>.tsxper component,tokens.css),html-css(index.html,styles.css,tokens.css),tokens-dtcg(tokens.json),tokens-css,tailwind-theme(@theme). Variables stay CSS custom properties unlessvariables:false. svg(one file per root) andpdf(one page per root, fonts embedded) use the committed layout and the canvas's text measurement, so line breaks match the canvas.
With outDir the files are written there; without it, code/token/svg/pdf files come back inline
in files[].contents (pdf as base64). Existing files with other contents are never replaced
unless you pass overwrite:true (otherwise FILE_EXISTS, nothing written). The result lists
issues: the places an exporter approximated (unsupported effect, blend mode, and so on). Read
them before you ship the code.
kimo_render {format:"svg"} returns SVG text instead of a PNG for a quick look.
The exporter output is a faithful starting point. When you implement a design in an existing codebase, translate it with that codebase's components and conventions, as below.
Implementing a design in code
kimo_query {select:{ids:[frameId]}, depth:10, resolveVariables:false, include:["bounds"]}. Keep bindings unresolved so you see token names.kimo_get_variables {docId, resolve:true}. Map each variable to a CSS custom property or a theme token. Themed values become per-theme values ([data-theme=dark]).- Translate node by node:
layout.dir/→ flexgap/ pad/ justify/ align direction/(gap/ padding/ justify-content/ align-items between→space-between);w/hfixed → width/height;fit→ auto;fill→flex: 1on the main axis, oralign-self: stretchon the cross axis;position:"absolute"+ x/y → absolute positioning in a relative parent;radius,stroke(aligninside→ border or inset box-shadow),effects→ box-shadow / filter / backdrop-filter;- text
style→ font-family/size/weight, line-height (a multiplier stays unitless), letter-spacing px.
- Instances: one code component per Kimo component, with declared props as typed props.
kimo_list_componentslists them. - Compare: render the frame with
kimo_renderand the implementation in a browser at the same width.
Keep the node tree's nesting and order in the DOM. Don't flatten containers. Their padding and gap are where the spacing lives.