Livestream: Building landing pages with AI | 4/3

Announcing Visual Copilot - Figma to production in half the time

Builder logo
builder.io
Contact SalesGo to App

Livestream: Building landing pages with AI | 4/3

Announcing Visual Copilot - Figma to production in half the time

Builder logo
builder.io

Blog

Home

Resources

Blog

Forum

Github

Login

Signup

×

Visual CMS

Drag-and-drop visual editor and headless CMS for any tech stack

Theme Studio for Shopify

Build and optimize your Shopify-hosted storefront, no coding required

Resources

Blog

Get StartedLogin

When working with TypeScript, you can leverage these interfaces for better type safety in your mapping functions:

export type FigmaNodeType =
  | "COMPONENT"
  | "ELLIPSE"
  | "FRAME"
  | "GROUP"
  | "INSTANCE"
  | "LINE"
  | "POLYGON"
  | "RECTANGLE"
  | "STAR"
  | "TEXT"
  | "VECTOR";

export interface FigmaNode extends BaseFigmaProps {
  /** Figma node "name" */
  $name: string;

  /** Figma node type (FRAME, GROUP, TEXT, etc.) */
  $type:
    | "COMPONENT"
    | "ELLIPSE"
    | "FRAME"
    | "GROUP"
    | "INSTANCE"
    | "LINE"
    | "POLYGON"
    | "RECTANGLE"
    | "STAR"
    | "TEXT"
    | "VECTOR";

  /** Represents the text content of the node and its descendants */
  $textContent: string;

  /** URL to the rasterized image of this node */
  $imageUrl: string;
}

export interface BaseFigmaProps {
  /** Direct children of the root component node or instance */
  $children: (FigmaNode | undefined)[];

  /** Recursively finds the first figma child with the given name, among all descendants */
  $findOneByName(name: string | RegExp): FigmaNode | undefined;

  /** Recursively finds all nodes with the given name, among all descendants */
  $findAllByName(name: string | RegExp): FigmaNode[];

  /** Recursively finds the first node that matches the predicate, among all descendants */
  $findOne(predicate: (node: FigmaNode) => boolean): FigmaNode | undefined;

  /** Recursively finds all nodes that match the predicate, among all descendants */
  $findAll(predicate: (node: FigmaNode) => boolean): FigmaNode[];
}

When creating a mapping function for a specific component, you should extend BaseFigmaProps with the properties from your Figma component:

figmaMapping({
  componentKey: "button-component-key",
  mapper(figma: FigmaButtonProps) {
    return (
      <Button
        color={figma.Color?.toLowerCase()}
        size={figma.Size?.toLowerCase()}
        type={figma.Variant?.toLowerCase()}
      >
        {figma.$children}
      </Button>
    );
  },
});

With these mapping capabilities, you can create an efficient design-to-code workflow that maintains consistency between your Figma designs and your Angular components. Use these commands at the command line.

Generate mappings:

npx builder.io@latest figma generate [figma-ids]

Publish mappings:

npx builder.io figma publish

Migrate existing mappings:

npx builder.io figma migrate

Re-authenticate:

npx builder.io figma auth

The figma generate command supports several options:

--scaffold: creates basic mapping templates when automatic generation fails.

npx builder.io@latest figma generate --scaffold

--verbose: provides more detailed output during the mapping process.

npx builder.io@latest figma generate 9ca66... --verbose

--output: specifies the output directory for generated mappings.

npx builder.io@latest figma generate 9ca66... --output=src/mappings

--ci: run in non-interactive mode for CI/CD environments.

npx builder.io@latest figma generate 9ca66... --ci --componentName="Button" --mappingOutput="src/mappings/Button.mapper.tsx"
  • Generate mappings: npx builder.io@latest figma generate [figma-ids]
  • Publish mappings: npx builder.io figma publish
  • Migrate existing mappings: npx builder.io figma migrate
  • Re-authenticate: npx builder.io figma auth

By understanding and using these mapping capabilities, you can create a seamless design-to-code workflow that maintains consistency between your Figma designs and your React components.

Was this article helpful?

Product

Visual CMS

Theme Studio for Shopify

Sign up

Login

Featured Integrations

React

Angular

Next.js

Gatsby

Get In Touch

Chat With Us

Twitter

Linkedin

Careers

© 2020 Builder.io, Inc.

Security

Privacy Policy

Terms of Service

Get the latest from Builder.io

By submitting, you agree to our Privacy Policy

  • Platform Overview

  • Integrations

  • What's New

  • Figma to Code Guide

  • Composable Commerce Guide

  • Headless CMS Guide

  • Headless Commerce Guide

  • Composable DXP Guide

  • Design to Code

  • Blog

  • Knowledge Base

  • Community Forum

  • Partners

  • Templates

  • Success Stories

  • Showcase

  • Resource Center

    Glossary

© 2025 Builder.io, Inc.

Security

Privacy Policy

SaaS Terms

Security & Compliance

Cookie Preferences

Gartner Cool Vendor 2024