Case 04 · Design to code

Coral

One format for a component, wherever it was made. Open a Figma design as HTML, edit it in code, send it back to Figma. AI has since changed the problem, so Coral is parked, but the idea of one shared source still drives my systems work.

Role
Design and engineering
Year
2025
Built with
TypeScript, Zod, a CLI, a Figma plugin

01The problem

Design and code drift apart.

When design and code are two separate sources of truth, every change becomes two tickets and two reviews, and a QA pass to catch where they disagree. When the tools or frameworks change, the system gets rebuilt.

Most teams accept that as normal. I think it's a structural problem.

  1. Two sources of truthEvery change is made twice.
  2. Tool lock-inChange a tool or framework and the system is rebuilt.
  3. TranslationSpecs get interpreted, and consistency lives in people's heads.

02Where it started

Superfun, a Figma plugin.

In 2021, before Figma had Dev Mode or Code Connect, I built Superfun. It read a selected frame through Figma's API and wrote it out as React, Vue, Svelte or HTML, with styles as CSS or Tailwind.

The part that mattered was the middle. Superfun turned a design into one neutral description first, and wrote every framework from that. Figma has since built most of this in, but the idea stayed with me: put a shared description between design and code, and the gap gets small enough to automate.

Superfun generating React code in Figma

Superfun generating React from a selected frame.

03The idea

A component, described as data.

Coral is that description, made into a standard. A component's structure, styles, variants, props, events and tokens live in one JSON file. Figma, React, HTML and Vue are just different ways to read and write it.

{
  "name": "Button",
  "elementType": "button",
  "componentVariants": {
    "axes": [
      { "name": "intent",
        "values": ["primary", "secondary"] },
      { "name": "size",
        "values": ["sm", "md", "lg"] }
    ]
  },
  "props": {
    "label": { "type": "string", "required": true }
  },
  "textContent": { "$prop": "label" }
}

The Coral UI plugin in Figma

The Coral plugin in Figma.

04Watch it work

From code to Figma and back.

In this walkthrough I import a component from code, look at the spec Coral makes from it, bring it into Figma, and sync a change back.

A four-minute walkthrough, with sound.

05Where it is

Open source, in beta.

Coral is a set of small open-source packages: the core spec and CLI, generators for React and HTML, a React parser, and converters between CSS and Tailwind. The docs and code are public.

The Coral UI playground

The Coral playground.