Design System

Design to Code - An example workflow

Figma is the single source of truth. Tokens sync to code automatically, components are read straight from Figma via the Figma MCP, and everything here is built from those tokens only.

Workflow

Two paths, one source of truth. Values flow automatically, structure is read on demand.

Tokens · fully automated

  1. StructureClaude defines layers and naming
  2. DesignFigma Variables hold every value
  3. SyncToken Bridge commits tokens to GitHub
  4. BuildA GitHub Action writes tokens.css

Components · via Figma MCP

  1. DesignFigma component with bound variables
  2. ReadClaude reads it via the Figma MCP
  3. ReviewDesign QA: wrong bindings get fixed in Figma
  4. CodeExisting components are reused

Where a standard exists, use it. Where none fits, build the gap.

Figma's Variables REST API is Enterprise-only, so tokens travel through a custom plugin. For components, the Figma MCP is the standard, so it is used as is.

From Figma to a live component

How the Sign-up Card went from Figma to code. Two MCP reads, no hand-written spec.

  1. 1. Select the component in Figma

    Right-click the component set, copy the link to the selection. The link carries the node id, so only this component is read.

  2. 2. Claude reads it via the Figma MCP

    One call to get_design_context returns every state, the auto layout, the text styles and the variable bound to each layer.

  3. 3. Design QA, then read again

    The first read showed foreign library variables and mixed-up tokens that no screenshot would reveal. They were fixed in Figma, a second read confirmed it.

  4. 4. Translate into the project

    The MCP returns a React + Tailwind reference. It is adapted to this project: Form Field, Checkbox, Alert and Button are reused, only the card layout is new. Full breakdown

The Sign-up Card in Figma, all four states: default, error, server error, success
In Figma · all four states
In code · live. Submit empty, then fill it in.

One token, three layers

Aliases survive the whole way from Figma into CSS.

/* Component */
--button-primary-bg-default: var(--color-action-primary-bg-default);
/* Semantic */
--color-action-primary-bg-default: var(--color-purple-600);
/* Primitive */
--color-purple-600: ;

Use it in your project

No install needed. The CSS is served straight from the public repository via jsDelivr.

  1. 1. Add the stylesheets

    Tokens first, then the components you need. Plus the two web fonts.

    HTML · head
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Roboto:wght@400;500&display=swap">
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Tobias-Stoll/DesignSystem@main/dist/tokens.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Tobias-Stoll/DesignSystem@main/dist/typography.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Tobias-Stoll/DesignSystem@main/components/button.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Tobias-Stoll/DesignSystem@main/components/input.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Tobias-Stoll/DesignSystem@main/components/checkbox.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Tobias-Stoll/DesignSystem@main/components/alert.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Tobias-Stoll/DesignSystem@main/components/form-field.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Tobias-Stoll/DesignSystem@main/components/signup-card.css">
  2. 2. Use the components

    Plain HTML with a class. All variants and states are on the component pages: Button, Input, Checkbox, Alert, Form Field, Sign-up Card.

    HTML · body
    <button class="btn btn--primary">Subscribe</button>
    
    <input class="input" type="email" placeholder="you@example.de">
    
    <label class="checkbox">
      <input type="checkbox" class="checkbox__box">
      <span class="checkbox__text">
        <span class="checkbox__label">I want to receive the newsletter</span>
      </span>
    </label>
    
    <div class="alert alert--success" role="status">You're subscribed!</div>
    
    <h2 class="text-heading-m">Text styles work as classes too</h2>
  3. 3. Use tokens in your own CSS

    Every Figma variable is a CSS custom property.

    CSS
    .my-card {
      background: var(--color-bg-default);
      border: var(--border-width-default) solid var(--color-border-default);
      border-radius: var(--radius-container);
      padding: var(--space-inset-lg);
      color: var(--color-fg-default);
    }
  4. Two rules

    Use semantic or component tokens, never primitives. --color-action-primary-bg-default, not --color-purple-600. That way a design change in Figma reaches your code without edits.

    Never change tokens in code. Figma is the source of truth: values are changed there and arrive here through the export.

Note: @main always points to the latest export, but jsDelivr may cache it for up to 12 hours. In a production project you would pin a release, for example @v1.0.0.