Docs
  • Introduction
  • 🚀Get started
    • 1️⃣Install the plugin
    • 2️⃣Load Clapy in your file
    • 3️⃣Sign in/up to Clapy
    • 4️⃣Get code in 1 click
    • Online code preview/editor, Github, and more
  • 🖌️Figma Basics
    • Components
    • Your first Figma component
    • Add auto-layout in Frames
    • Groups vs Frames
  • ⚙️The generated code
    • The project structure
    • Components
    • Instances
    • Figma Tokens integration
    • Responsive code
  • ℹ️Extras
    • Changelog
      • 01/08/2022
      • 25/07/2022
      • 15/07/2022
    • Github
Powered by GitBook
On this page

Was this helpful?

  1. The generated code

Figma Tokens integration

Clapy partners with the team of Figma Tokens, a plugin that helps to design on Figma using design tokens.

PreviousInstancesNextResponsive code

Last updated 2 years ago

Was this helpful?

Any question about the design decisions? Anything not matching your project practices? ! we may add an option for the flexibility you need.

Clapy seamlessly extracts the design tokens managed by and generates code leveraging them.

For example, let’s say you have defined your colors, fonts, spacings… using Figma Tokens. When generating code with Clapy, tokens will be extracted seamlessly and included in the output project as CSS variables, in src/variables.css.

:root {
  --spacing-scale: 2px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 32px;
  --spacing-xl: 64px;
  --sizing-scale: 1.5px;
  /* ... */
}

Components will use those variables following the Figma Tokens configuration, e.g.:

.card {
  padding: var(--spacing-xs);
}

When a style doesn’t have a variable defined, it falls back to the Figma values, e.g.:

.card {
  padding: var(--spacing-xs);
  width: 300px;
}

Clapy embeds a fork of to generate the variables, which is useful to generate a fully working project. But you’re free to setup your own pipeline generating variables from Figma Tokens, and include them in the target project. The components will refer to those variables following the Style Dictionary and Figma Tokens standards.

⚙️
Please let us know
Figma Tokens
Style Dictionary