Export Figma to a new Angular component

Intro

Figma node can be exported to a new Angular component even with no configuration at all. There are 3 simple steps to achieve that:

  1. Open Figmular

  2. Select a Figma node

  3. Copy the result, download it, or deploy it to CodeSanbox

circle-info

For the best results, we recommend using Figma's auto-layout where possible

There are three examples on this page:

Example #1 - Export a simple Frame

Example #2 - Export a component with variants or building your design system

Example #3 - Export a Frame with Components

Example #1 - Export a simple Frame

First, let's try to export a simple frame that has no other components inside. Our test frame looks like this:

Simple frame with no components inside

Now let's open Figmular and select the Notifications frame. It should generate the following code:

The rendered result looks like this:

The result rendered in CodeSandbox

Example #2 - Export a component with variants or building your design system

In the next case, our designer has created a new component that should be used across all our projects, so it should become a part of our design system library.

Here is our component:

Component with variant

Our component has 6 variants and 3 properties:

  • IsRemovable that can be 'true' or 'false'

  • Shape that can be 'Round', 'Square', or 'Semi'

  • Text that is bonded to the label value

Let's see how Figmular exports our Angular components for this frame:

In the result we can see that:

  • Figmular used conditions to change the layout based on the input parameters

  • The TypeScript file contains correct input fields and their possible values

  • SVG icon has been exported in the process

Now you can just copy those files into your project, or into your design system library and start using the SimpleChipComponent.

Example #3 - Export a Frame with Components

In this example, we will use an updated frame from Example #1 - Export a simple Frame where the plain chips are replaced with instances of our new component Simple Chip with different properties:

Frame with components

As developers, we would like to export this frame to a new Angular component, so we need to have the Simple Chip component exported as well. Let's generate Angular code for this frame using Figmular and see what we get:

First, we see a new dropdown below the code export section. This dropdown shows all the components involved in the current export operation:

Figmular - Exported Components dropdown

That means that SimpleChipComponent is exported as a part of the package as well. And we can see its usage in the frame's component like this:

Here is the final result rendered in CodeSandbox:

Rendered frame

Summary

In all these examples, we just exported Figma to Angular components with plain HTML, TypeScript, and CSS using Figmulararrow-up-right. If you want to use components from an existing design system such as Angular Material or even components from your own design system in the export process, see the following pages:

Last updated