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
  • The basics
  • The layout
  • Let's style it a bit

Was this helpful?

  1. Figma Basics

Your first Figma component

PreviousComponentsNextAdd auto-layout in Frames

Last updated 2 years ago

Was this helpful?

If you already have a Figma design, you can skip this section and directly head to the next one: .

If you don't have Figma designs yet, this sections helps you setup your first design, ready to be converted into code with Clapy.

The basics

The first step is to create a and open their application. You can use the web app or the desktop app.

Once Figma is opened, create a New design file.

Its easy to create our first design file with Figma

After you have successfully created your design file, it is time to create your first frame.

It is important for Clapy that we use frames instead of rectangles as containers, to generate high quality code.

For background colors, use the fill property of your frames.

Rectangles should only be used in specific cases where that's the shape you want for a drawing.

Awesome, we've got the right setup to get started. To continue, add a Text in the frame you've just created.

The layout

Very well. Now that we've got our text, let's define the layout. Select your text, right-click, then choose "Add auto layout" (or you can use the shortcut: SHIFT + A).

The text is now wrapped into a sub-frame using the auto layout.

Good to know: Using auto layout is generally a good practice, especially to get clean code with Clapy.

Let's style it a bit

Now we are ready to give our button a color. You can do this by selecting your frame and going over to the right to see the properties panel. Here, you can select the fill and give your button a color.

Awesome, we are almost done! Select your frame and look at the properties panel again. You will see something called Auto layout. You will see some properties with default values, e.g. 10 for the padding. We can adjust these by clicking when the arrow cursor appears and dragging horizontally.

Wow, that went very well! Our last step is to make our outer frame an auto layout as well. We can do this by selecting it and pressing SHIFT + A (or right-click > Add auto layout).

We can now adjust the properties a bit. In the Auto layout section, a table with 9 cells represent the vertical and horizontal alignment of the selection's children. Select the middle one.

We are almost done! Select your outer frame again, and you will see at the top of your properties panel the width and height of your frame. Set the width from hug to fixed.

Awesome. Finally, right-click on your button and click Create component. And thats all!

Creating our first frame
Writing some text

You can find a presentation here:

and a playground here:

Giving our button a color
Adding padding to our button
Selecting center alignment of our auto layout

Congratulations! We've created our first component, . 🥳

🖌️
https://www.youtube.com/watch?v=TyaGpGDFczw
https://www.figma.com/community/file/784448220678228461
ready to be turned into code by Clapy
Generate code with Clapy
Figma account