Figma to shadcn/ui plugin

Convert Figma designs to shadcn/ui code and manage design system variables

The Figma to shadcn/ui plugin is a powerful tool that uses AI to automatically convert Figma designs into production-ready shadcn/ui and Tailwind CSS, while managing your design tokens seamlessly. It bridges the gap between design and development by generating responsive, accessible code and maintaining design system consistency through bi-directional variable management - export to CSS or import from your codebase with ease.

Getting started

The plugin works best with the shadcn/ui kit for Figma by shadcndesign team. Use components, variables, and styles from our UI kit to ensure accurate code generation

  1. Open the Figma to shadcn/ui plugin via the Figma Community in our shadcn/ui kit for Figma file.
  2. Provide your license key - if you purchased the Premium package, you can find it in My Orders page after logging in to Lemon Squeezy. Please note: if you purchased the personal license, you can only activate the license key on one Figma account.

Generating code

To generate the components in our plugin, you must have a valid API key from one of the AI platforms mentioned below:

  • Google AI Studio
  • Anthropic AI

In our plugin, we support these AI models:

  • Gemini 2.5 Pro
  • Claude 3.5 Sonnet

Google AI Studio

We recommend using Gemini 2.5 Pro model - it provides the best results and it’s cheaper than other models.

  1. Sign in or create your Google AI Studio account
  2. Create API key
  3. Add credits in the billing page.
  4. Open the Figma to shadcn/ui plugin
  5. Open the plugin settings
  6. Select the Gemini 2.5 Pro model.
  7. Enter your API key in the plugin settings (the key is stored locally and securely)
  8. Press the Verify key button to proceed. If the key is valid, you can start using the plugin.

Anthropic AI

  1. Sign in or create your Anthropic AI account if you haven’t already.
  2. Go to your Anthropic AI Billing tab and add credits. Credits are necessary to generate components with our plugin.
  3. Get your Anthropic API key from your settings page
  4. Open the Figma to shadcn/ui plugin
  5. Open the plugin settings
  6. Select the Claude 3.5 Sonnet model.
  7. Enter your API key in the plugin settings (the key is stored locally and securely)
  8. Press the Verify key button to proceed. If the key is valid, you can start using the plugin.

Open AI

  1. Sign in or create your Open AI account if you haven’t already.
  2. Go to your billing and add credits.
  3. Get your API key from API keys page.
  4. Open the Figma to shadcn/ui plugin
  5. Open the plugin settings
  6. Select the GPT 4.1 model.
  7. Enter your API key in the plugin settings (the key is stored locally and securely)
  8. Press the Verify key button to proceed. If the key is valid, you can start using the plugin.

Generate code

  1. Open the Figma to shadcn/ui plugin.
  2. Select the frame or component instance in Figma
  3. Use the “+” icon in the plugin's interface to add desktop variant
  4. Optionally, select the mobile variant of your design and press the “+” icon.
  5. Monitor token count to stay within API limits (Tier 1: 40,000 tokens, Tier 2: 80,000 tokens; learn more on token limits here. If needed, consider splitting larger components.
  6. Press the Generate Code button and wait.

Using Generated Code

After generating code, you have several options:

  1. Copy Code: Click "Copy Code" to get the component code
  2. Copy CLI: Get the shadcn/ui CLI command to add the component to your shadcn/ui project
  3. Open in v0: Open the component directly in v0 for further customization

The CLI command and Open in v0 link will be available for 24 hours after each generation.

Best practices

Layers naming

Name your frames in Figma accordingly:

  1. "Container" for main wrappers - if you want to have your div use the TailwindCSS “container” class
  2. "Flex" for frames with horizontal auto layout applied
  3. "Flex Vertical" for frames with vertical auto layout applied
  4. "Grid" for grid layouts
  5. “Video” for videos
  6. “Image” for images
  7. You can also use the Aspect Ratio component for images and videos to get the desired ratio in the generated code

Spacing

  1. Use spacing variables from the shadcn/ui kit for Figma
  2. Use size variables from the shadcn/ui kit for Figma
  3. Avoid fixed widths when possible to ensure responsiveness

Colors

Use color variables from the shadcn/ui theme, such as "base/background" for backgrounds and "base/foreground" for text.

Typography

  1. Use the typography styles defined in the UI kit
  2. Use the typography variables defined in the UI kit

Icons

The plugin works best with Lucide icons available in the UI kit

Charts

Charts are not supported yet, we are working on it.

Troubleshooting

If you encounter issues:

  • Ensure your API key is valid
  • Check that your design follows shadcn/ui patterns
  • Verify you're within the token limits
  • Try breaking larger components into smaller pieces
  • Make sure your Figma variables are properly set up

Managing Variables

The plugin features a "Manage Variables" tab for handling design tokens.

Export Variables (Tailwind v4)

This feature is compatible with shadcn/ui Figma kit version May 2025 and newer. Follow these steps to export your theme settings:

  1. Launch the plugin within your main shadcn/ui kit for Figma library file
  2. Navigate to the "Manage Variables" tab
  3. Select the "Export (v4)" tab
  4. Choose your desired theme for export
  5. Select your preferred color mode
  6. Click "Generate CSS"
  7. Click "Copy CLI" to copy the command
  8. Open your shadcn/ui project in your code editor
  9. Access the terminal in your IDE
  10. Paste and execute the CLI command. Note: This process will overwrite your existing globals.css file with the theme settings from Figma. Consider creating a backup of your globals.css file before proceeding.

Export Variables (Tailwind v3)

This feature is dedicated to shadcn/ui kit for Figma version January 2025 and below. Follow these steps to export your theme variables:

  1. Open the plugin in the main shadcn/ui kit for the Figma library file.
  2. Switch to the "Manage Variables" tab.
  3. Select the "Export (v3)" tab.
  4. Click "Generate CSS" to export your Figma variables as CSS.
  5. Copy the generated CSS for the selected theme (if multiple themes exist).
  6. Paste the generated variables into your project’s globals.css file to replace the existing ones.

Import Variables (Tailwind v3)

This feature is dedicated to shadcn/ui kit for Figma version January 2025 and below. Follow these steps to import your theme variables to Figma:

  1. Go to the "Import" tab.
  2. Select the theme to which you want to apply the variables:
    1. Existing theme (e.g., Default) - this will replace the variables with the values you provide.
    2. New theme - this will add a new theme in the Figma variables panel with the variables you provide.
  3. Make sure your variables match the structure presented below
  4. Paste your CSS variables.
  5. Click "Import Variables" to update your Figma variables.
@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 224 71.4% 4.1%;
    --card: 0 0% 100%;
    --card-foreground: 224 71.4% 4.1%;
    --popover: 0 0% 100%;
    --popover-foreground: 224 71.4% 4.1%;
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 210 20% 98%;
    --secondary: 220 14.3% 95.9%;
    --secondary-foreground: 220.9 39.3% 11%;
    --muted: 220 14.3% 95.9%;
    --muted-foreground: 220 8.9% 46.1%;
    --accent: 220 14.3% 95.9%;
    --accent-foreground: 220.9 39.3% 11%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 20% 98%;
    --border: 220 13% 91%;
    --input: 220 13% 91%;
    --ring: 262.1 83.3% 57.8%;
    --radius: 0rem;
    --chart-1: 12 76% 61%;
    --chart-2: 173 58% 39%;
    --chart-3: 197 37% 24%;
    --chart-4: 43 74% 66%;
    --chart-5: 27 87% 67%;
  }

  .dark {
    --background: 224 71.4% 4.1%;
    --foreground: 210 20% 98%;
    --card: 224 71.4% 4.1%;
    --card-foreground: 210 20% 98%;
    --popover: 224 71.4% 4.1%;
    --popover-foreground: 210 20% 98%;
    --primary: 263.4 70% 50.4%;
    --primary-foreground: 210 20% 98%;
    --secondary: 215 27.9% 16.9%;
    --secondary-foreground: 210 20% 98%;
    --muted: 215 27.9% 16.9%;
    --muted-foreground: 217.9 10.6% 64.9%;
    --accent: 215 27.9% 16.9%;
    --accent-foreground: 210 20% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 20% 98%;
    --border: 215 27.9% 16.9%;
    --input: 215 27.9% 16.9%;
    --ring: 263.4 70% 50.4%;
    --chart-1: 220 70% 50%;
    --chart-2: 160 60% 45%;
    --chart-3: 30 80% 55%;
    --chart-4: 280 65% 60%;
    --chart-5: 340 75% 55%;
  }
}

FAQ

Is the plugin compatible with any shadcn/ui kit for Figma?

No, for the best results, we recommend using the plugin specifically with the shadcn/ui kit for Figma created by shadcndesign team. To achieve the best possible outcomes, use our recommended shadcn/ui kit and follow the abovementioned best practices.

Can I try plugin for free?

Yes. There are 10 free users available. Go to the plugin's Figma Community page to test the plugin in your copy of the shadcn/ui kit for Figma.

Do I need access to paid AI model credits to use the plugin?

Yes. The plugin uses AI credits from your AI platform account for all component generation tasks.

How much does code generation cost?

The cost is based on token usage. When you select a frame in Figma and add it using the "+" button, the plugin displays the estimated input token count for code generation. For current pricing details, please refer to the:

Is the quality of the generated code close to the original design in Figma?

Yes, the generated code accurately reflects your Figma designs when you’ll follow our best practices, with the plugin performing optimally for simpler, modular components rather than complex page layouts. For maximum fidelity, we recommend generating code for individual UI elements or smaller parts of your UI instead of entire pages. Using the Gemini 2.5 Pro model can also provide better results.