Skip to content

Code export

Export approved screens to React, Vue, Angular, HTML, React Native, SwiftUI and Jetpack Compose: files, tokens, mappings and measured pixel parity.

An approved screen can be exported as ready-to-use code for seven stacks. The export is deterministic: the same screen always gives the same files, and no AI model takes part in the translation. Your tokens are referenced, not copied, and components that you've mapped to your own code are imported instead of re-created.

Supported stacks

Stack--targetFilesTokens file (specimo tokens --format …)Component mappings
Reactreact (default)Name.tsx, Name.csstokens.css (css)Web (React)
VuevueName.vue, Name.csstokens.css (css)Vue
Angularangularname.component.ts, .html, .css (standalone)tokens.css (css)Angular
HTMLhtmlname.html (a complete page), name.csstokens.css (css)none (everything is inlined)
React Nativereact-nativeName.tsx (StyleSheet)theme.ts (react-native)React Native
SwiftUI (iOS)swiftuiNameView.swift, SpecimoSupport.swiftDesignTokens.swift (swift)iOS
Jetpack Compose (Android)composeNameScreen.kt, SpecimoSupport.ktDesignTokens.kt (compose)Android

How to export

From an agent (MCP): call export_screen with screen and target. Add version: "latest" to export a draft that's still under review.

From the CLI: the CLI writes the files straight to disk, so they never pass through the agent's context.

specimo tokens --format css --out src/styles/tokens.css
specimo screen checkout --out src/screens                       # React
specimo screen checkout --target vue --out src/screens
specimo screen checkout --target swiftui --out Sources/Screens

From the app: open a screen and use Export as code in the version panel.

What you get

  • Layout and styling as designed.
  • Web targets keep the designed HTML and CSS. The CSS is scoped to the screen, so several screens can live in one app.
  • Native targets translate what the browser computes at phone width (390 px) into native views and modifiers. That covers layout, spacing, colours (including oklch and color-mix), fonts per weight, CSS line heights, shadows and SVG icons.
  • Your components. A component with an approved code mapping for the target's platform is imported with its props. The rest are inlined.
  • States and translations. data-state becomes a state prop or parameter, and data-i18n text becomes a t(key, fallback) call.
  • A TODO list. Anything a deterministic export can't decide comes back as a short list instead of a silent approximation: navigation, data bindings, hover states, fonts to bundle, images to add as assets.

Pixel parity

We exported two real screens (an events marketplace's login and pricing pages) out of the box, with no edits, and compared each render with the original web page pixel by pixel:

StackRendered inLoginPricing
React, Vue, Angular, HTMLChrome, 390 px100%99.4–99.5%
React, Vue, Angular, HTMLChrome, 1280 px99.8%99.98%
React Nativereact-native-web in Chrome, 390 px99.45%99.07%
Jetpack ComposeAndroid emulator, 390 dp97.2%94.3%
SwiftUIiOS simulator, 390 pt94.6%91.6%

Native renderers draw text glyphs slightly differently from a browser, so a few percent of the pixels in text-heavy areas always differ, even when the layout is identical. The remaining differences are listed in the export's TODOs, such as a logo to add as an asset. More in the blog.

Tips

  • Load the tokens file once per app; every screen's styles refer to it.
  • Re-export after a design change instead of editing the files by hand.
  • Map your components (Design system → Code mappings) so exports use your real components instead of inlined markup.