Skip to main content
Once your design is in good shape on the canvas, get_jsx converts it to a React component you can drop straight into your codebase. The tool handles the HTML-to-JSX transformation — attribute renaming, self-closing tags, style extraction — and gives you a choice of how CSS lands in the output: as Tailwind className strings or as a style prop object. This guide covers both modes, shows you how to scope the export to a specific component, and walks through saving the result as a .tsx file.

Prerequisites

  • A design on the canvas with at least one component ready to export
  • Your agent connected and ping returning { pong: true } (see Design with an agent)

Choosing an export mode

get_jsx accepts an optional mode parameter with two values:

tailwind (default)

Preserves className on every element. CSS properties that map directly to Tailwind utilities — padding, margin, color, background-color, width, height, display, flex-direction — are dropped from the inline style prop and kept as class names. Use this when your React project already uses Tailwind.

inline

Converts every CSS property to a JSX style object. No Tailwind dependency required. Use this when you’re importing into a project that uses CSS Modules, styled-components, or plain CSS.

Export the full canvas

To export everything on the canvas as a single component, call get_jsx with no arguments:
The default mode is "tailwind". The response contains a self-contained JSX string:

Export a single component

When the canvas has multiple sections, scope the export to just the element you need by passing its componentId:
To find the componentId of the element you want, click it in the canvas or layers panel, then call get_selection. The agent receives the id and can pass it directly to get_jsx.

Tailwind mode in detail

In tailwind mode the agent outputs className props and omits a style prop for any property that Tailwind can express natively. The properties that get this treatment are: Properties that don’t have a direct Tailwind mapping (such as border-radius on an arbitrary pixel value, or letter-spacing) are preserved in the style prop alongside className. Example output — tailwind mode:
Because the canvas runs Tailwind v4 via CDN, arbitrary values like bg-[#0f172a] that the agent wrote during the design session appear verbatim in the JSX output — they work natively in any Tailwind v4 project without additional configuration.

Inline mode in detail

In inline mode every CSS property becomes a key in a style object. No Tailwind classes are emitted. This output is framework-agnostic and works in any React project:
Example output — inline mode:
Hover and focus states expressed as Tailwind variants (e.g., hover:bg-indigo-500) have no direct CSS equivalent in inline mode and will be dropped from the output. If interactivity matters, prefer tailwind mode or add the pseudo-class styles manually after export.

Save the output as a .tsx file

The full export workflow — scoping to a component, choosing a mode, and writing the file — looks like this when you direct an agent to handle it end-to-end:
1

Select the component in the canvas

Click the hero section in the canvas editor. Then ask the agent to call get_selection:
2

Call get_jsx with the component id

The agent receives the JSX string in the response.
3

Write the .tsx file

The agent writes the jsx string from the response to a file in your React project:
The file is ready to import. If you’re using Tailwind v4 in your React project, the classes are identical to what was on the canvas — zero style translation needed.
4

Import and use the component


Tips for cleaner exports

  • Name your components in the canvas. Use the layers panel to rename elements before exporting. The agent uses the component structure from the canvas tree, so well-named layers produce more readable JSX.
  • Group related elements before exporting. If you want a button and its label to export as a single component, make sure they share a parent wrapper in the canvas.
  • Export incrementally. Export one section at a time using componentId scoping rather than exporting the entire canvas. Smaller components are easier to review and integrate.
  • Re-export after style changes. If you refine styles on the canvas after an initial export, run get_jsx again — the canvas is always the source of truth.

Next steps

Manage design tokens

Set up CSS custom properties on the canvas so exported components automatically reference your brand colors and spacing scale.

Design with an agent

Back to the full design workflow — adding components, iterating with screenshots, and refining styles.