Tutorial · 10 min read

How to Import a Component Library into Figma

Your component library exists in code — buttons, cards, forms, modals — but not in a single Figma file. Here's the batch import workflow that gets you there in hours, not weeks.

HF

HTML to Figma Team

Last reviewed: March 2026

Component library import into Figma is the process of converting an existing HTML/CSS component library — such as a React, Vue, or plain HTML design system — into native, editable Figma components by copying rendered HTML from each component and converting it with the html2design plugin. The result is a Figma library that reflects exactly what ships in production.

Why You Need This Workflow

Many engineering teams build component libraries before — or without — a dedicated design system in Figma. The components exist in code, render correctly in the browser, and are used across the product. But there's no Figma file to hand off to designers, no shared library for the design team to extend, and no visual documentation of what the library actually looks like.

The manual path — recreating every button variant, every form state, every card layout from scratch in Figma — is prohibitively slow. A 40-component library with 3–5 variants each means 120–200 individual frames to draw by hand. At 20–40 minutes per frame, that's weeks of work.

html2design cuts that to hours. You render the component in a browser, copy its outerHTML from DevTools, paste it into the plugin, and get a native Figma frame with preserved typography, spacing, colors, and borders. One component in under 60 seconds.

Prerequisites

Phase 1: Audit and Categorize Your Library

Before importing, build a complete inventory of your components. Group them into tiers to prioritize the import order:

Import Tier 1 first. These are the most reused components — getting them into Figma quickly unlocks the most value for designers. Tier 4 can often wait or be assembled from already-imported atoms and molecules.

For each component, list the variants you need: states (default, hover, disabled, error), sizes (sm, md, lg), and themes (light, dark). Each variant will be a separate import pass.

Storybook tip: If your library is in Storybook, use the Canvas view for each story — it shows the component in isolation with the correct background and sizing. The URL format /story/component-name--variant makes it easy to iterate through all variants systematically.

Phase 2: Set Up Your Render Environment

You want each component rendered in isolation — no page chrome, no sidebar, no competing styles. Clean isolation produces cleaner Figma output.

The cleanest option is Storybook's canvas view. If you don't have Storybook, create a simple HTML test page that renders one component at a time:

<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="/dist/styles.css" /> </head> <body style="padding: 2rem; background: white;"> <!-- Render your component here --> <button class="btn btn-primary">Save Changes</button> </body> </html>

Using a white or neutral background is important — html2design reads background fills from the rendered output, so a dark or patterned page background can pollute the imported layer.

Phase 3: The Import Workflow

Step 1

Open DevTools and locate the component root

Right-click your rendered component in the browser → Inspect. In the Elements panel, find the outermost element of the component — typically a <div> or <button> with the component's root class. This is the element you'll copy.

Avoid selecting a parent wrapper that spans the full viewport. You want the component's own root, not the page layout around it.

Step 2

Copy outerHTML

Right-click the root element in DevTools → Copy → Copy outerHTML. This copies the full HTML markup including all child elements, with all resolved class names and inline styles.

If your component uses CSS custom properties (variables), switch to the Computed tab in DevTools and check whether the values look correct. html2design reads computed CSS, so custom properties are resolved automatically.

Step 3

Convert in html2design

In Figma, open the html2design plugin (Plugins → html2design). Paste your HTML into the input field. Click Convert. The plugin generates a native Figma frame on the canvas in 2–5 seconds.

Step 4

Rename the frame immediately

Before moving on to the next component, rename the frame in the Figma layers panel using your naming convention. A consistent format like Button/Primary/Default or Card/Default makes it easy to use the variants feature later.

Renaming as you go is much faster than renaming 80 frames after the fact.

Step 5

Repeat for each variant

Return to the browser, render the next variant (disabled state, different size, dark mode), copy, and convert. Stack variants horizontally on the Figma canvas — this makes it easy to visually compare states and apply Auto Layout later.

Phase 4: Organize and Clean Up in Figma

Once you've imported a full component group (e.g. all button variants), organize the Figma file:

Phase 5: Extract and Apply Design Tokens

html2design preserves the rendered CSS values — your exact colors, spacing, and typography — in the imported layers. This makes it straightforward to extract design tokens and set up Figma Variables:

  1. Select a component and inspect the layers to find recurring values. Your primary color, border radius, and spacing scale should appear consistently across multiple layers.
  2. In Figma, open Local Variables and create your token groups: Color, Spacing, Radius, Typography.
  3. Manually enter the token values from your codebase (or read them from the imported layers — they should match your CSS custom properties).
  4. Apply Variables to the imported component layers by selecting fills, strokes, and spacing values and linking them to the corresponding Variable.

This is the most time-intensive step, but it's a one-time setup. Once Figma Variables are applied, your library becomes truly token-driven — changing a color Variable updates every component that uses it.

Token reference page approach: Create a dedicated page in Figma with one imported element per token — a 24×24px square for each color token, a text layer for each typography token, a rectangle for each spacing token. This gives you visual anchors for setting up Variables without having to hunt through component layers.

Phase 6: Publish as a Figma Library

Once your components are imported, cleaned up, and token-linked:

  1. Open Assets → Team Library in Figma.
  2. Click Publish. Figma publishes all components and styles in this file as a shared library.
  3. Other team members can now enable this library in their files and use your components via the Assets panel.

Going forward, when engineers ship changes to a component, re-import the updated HTML to get a fresh Figma version, compare with the existing component, and update the library. This keeps design and code in sync without a full manual rebuild.

Frequently Asked Questions

How do I import a React component library into Figma?

Render each React component in a browser (Storybook is ideal — use the canvas view), copy the rendered outerHTML from DevTools, and paste it into the html2design plugin. React renders to HTML, so the plugin sees computed CSS regardless of whether the component uses Tailwind, CSS Modules, styled-components, or Emotion.

Can I import design tokens along with the components?

html2design preserves the rendered CSS values of each imported component. The colors, spacing, and typography in the Figma layers will match your token values exactly. You then create Figma Variables manually with those same values and apply them to the imported layers. It's two steps, but the imported values make the setup much faster — you're not guessing.

What about component interactions and hover states?

html2design imports a static snapshot — what the component looks like in one state at the time you copy the HTML. For interactive states (hover, focus, active, disabled), you import each state separately by triggering the state in the browser before copying. In Figma, combine these as Variants to create interactive prototypes.

Key Takeaways


Related Articles

Try it now

Import your first component in 30 seconds

Copy any component from Storybook or DevTools. Paste into html2design. Get a native Figma frame with preserved design tokens instantly.

Install from Figma Community →

$12/mo · $96/yr · Cancel anytime

← Back to Blog