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 | --target | Files | Tokens file (specimo tokens --format …) | Component mappings |
|---|---|---|---|---|
| React | react (default) | Name.tsx, Name.css | tokens.css (css) | Web (React) |
| Vue | vue | Name.vue, Name.css | tokens.css (css) | Vue |
| Angular | angular | name.component.ts, .html, .css (standalone) | tokens.css (css) | Angular |
| HTML | html | name.html (a complete page), name.css | tokens.css (css) | none (everything is inlined) |
| React Native | react-native | Name.tsx (StyleSheet) | theme.ts (react-native) | React Native |
| SwiftUI (iOS) | swiftui | NameView.swift, SpecimoSupport.swift | DesignTokens.swift (swift) | iOS |
| Jetpack Compose (Android) | compose | NameScreen.kt, SpecimoSupport.kt | DesignTokens.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
oklchandcolor-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-statebecomes astateprop or parameter, anddata-i18ntext becomes at(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:
| Stack | Rendered in | Login | Pricing |
|---|---|---|---|
| React, Vue, Angular, HTML | Chrome, 390 px | 100% | 99.4–99.5% |
| React, Vue, Angular, HTML | Chrome, 1280 px | 99.8% | 99.98% |
| React Native | react-native-web in Chrome, 390 px | 99.45% | 99.07% |
| Jetpack Compose | Android emulator, 390 dp | 97.2% | 94.3% |
| SwiftUI | iOS simulator, 390 pt | 94.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.