Designers
Reduce developer questions and create components that translate perfectly to code. Learn Auto-Layout patterns, property and layer naming conventions, design tokens and handoff best practices.
The landscape of product design nowadays requires many more skills, knowledge, and expertise. We designers have learned about research methods for understanding user needs, data analysis for product growth, psychology for understanding others, and list goes on. Another important area where we may improve personally and learn new things is front-end development which is an emerging skill that is becoming more and more important. Analysis of current job market data shows that one in five Product Designer positions now requires front-end development knowledge which is a clear signal that technical skills have shifted from optional to essential.
Most required skills in job listings for Product Designers in 2024-2025 (Source)
This article is a guide for designers who want to create components that are easy to implement in code. It covers the fundamentals of component design, including structure, properties, design tokens, and interactions.
Topics covered in this article
Learning these fundamentals will improve your design process and communication. During product development, design must communicate with a variety of stakeholders, including researchers, product managers, developers, testers, data analysts, and others. But developers are probably the ones we see, talk to, and discuss the most. When designers and developers speak the same language, communication is improved, misunderstandings are decreased, expectations and reality can be discussed, and design and development can coexist peacefully.
Approximate communication frequency with stakeholders for a designer
In this article, we'll explore best practices for designing components for JavaScript frameworks and libraries. At the end of reading, you will have a solid understanding of:
From Figma to React, Svelte, Vue, or Angular
Who benefits from reading this article?
Reduce developer questions and create components that translate perfectly to code. Learn Auto-Layout patterns, property and layer naming conventions, design tokens and handoff best practices.
Implement designs faster with clear component structure. Understand design decisions and reduce refactoring by recognizing well-structured Figma files.
Accelerate feature delivery with better design-dev collaboration. Understand technical constraints and reduce sprint delays from unclear component specs.
Whether you're a product designer, UI/UX designer, or front-end developer, mastering these concepts will greatly enhance your ability to create cohesive and user-friendly interfaces. By the end, you'll understand not just what makes a good component, but why certain decisions matter and how they impact the final product. If you are ready to take your component design skills to the next level, let's dive in!
Button, Tag, and Icon-Button components
A component is a single, reusable UI element within a product, a building block that can be used repeatedly with different configurations. This concept mirrors both design systems and code architecture. Modern practices like Atomic Design emphasize the importance of breaking down components into their most basic parts to create a more efficient and scalable design process.
Learn more about atomic design principles and how to apply them in your work. Visit the Brad Frost's Atomic Design website for a comprehensive guide.
Understanding this hierarchy and their relationships is crucial for creating effective components, design systems, and products. By leveraging atomic design principles, you can ensure consistency and scalability across your projects.
Despite syntactic differences, all modern JavaScript frameworks and libraries share a common component-based architecture:
Universal Component Model Diagram
When you design components with these universal concepts in mind, your work translates smoothly across most popular frameworks. A well-designed button in Figma becomes an equally well-implemented button in React (technically a library, not a full framework), Vue, Angular, or Svelte.
Basic properties for a button component in TypeScript
Properties (props) define a component's (object) identity and characteristics. Each property has a name and a value , and each of these name/value pairs tells you something about the component itself.
Properties have a name and a value
Duckett (2014) defines properties with a car analogy. Consider two cars: each has properties like brand, model, year, and passenger capacity where each serves a specific purpose. Both cars have these properties where the first car is a Toyota and the second car is a Honda. The first car is a Corolla and the second car is a Civic. The first car is a 2020 and the second car is a 2021. The first car has a passenger capacity of 5 and the second car has a passenger capacity of 5.
Property comparison for two different cars
The car objects have the same properties but with different values. They tell you the maker of car,model, year, and passenger capacity. Similarly, any UI component has properties like them. For instance, a button component might have properties like:
label: stringtype: enum ('primary' | 'secondary' | 'tertiary')size: enum ('small' | 'medium' | 'large')isDisabled: booleanisLoading: booleanstartIcon: component instanceendIcon: component instanceonClick: functionAbove properties tells us the abilites of the button component. The idea of name and value pairs is used in both HTML and CSS. In HTML, an attribute is like a property. Different attributes have different names, and each attribute can have a value. Name and Value pairs are used a lot in programming.
The Fundamentals of JS-Friendly Components Diagram
Designing components that developers can efficiently implement requires mastering four fundamental principles:
Learning these fundamentals will help you design components that are not only visually appealing but also easy to implement and maintain. Let's dive into each fundamental in depth. We will start with the first fundamental: Structure.
The arrangement and organization of HTML elements within a document is referred to as its structure. This structure establishes the relationships between the various sections of a web page and the way content is presented. Below is an example of a basic HTML structure.
HTML uses various elements to structure the content of a page. These elements are called tags. Each tag has a specific purpose and is used to create different types of content.
Sample HTML tags which are used to structure the content
In design, we define this structure by using frames. Each frame we use is translated to a HTML element. Belows is the example of frame nesting for the basic HTML structure mentioned above.
Basic Frame Nesting for the Basic HTML Structure
While desiging a page or a component, we actually define the HTML structure. That is why it is important to understand and know how to nest frames within each other. In the next section, we will cover how to use Auto-Layout, how to name frames, and how to use them in a proper way.
Figma offers two ways to nest objects: Groups and Frames. Groups are the traditional Adobe-style approach, while Frames unlock Figma's powerful Auto-Layout feature.
Using Auto-Layout will allow us to define the layout of the component in a more flexible way. Auto-Layout in Figma directly corresponds to CSS Flexbox properties. When you configure Auto-Layout settings, you're essentially defining:
display: flex or display: inline-flexflex-direction: row or flex-direction: columnjustify-content and align-items valuesgap for spacing between childrenpadding for internal spacingwidth: auto (hug contents) or width: 100% (fill container)Auto-Layout types available in Figma
Besides defining the layout of the component, Auto-Layout also allows us to define the spacing between the children of the component with using Gap and Padding properties.
Gap and Padding properties in Auto-Layout
Learn more about Figma Auto-Layout and how it maps to CSS Flexbox. Visit the Figma Help Center for a comprehensive guide.
Key principle:
Your frame structure defines the HTML structure. Each frame typically becomes an HTML element (most commonly a <div> container, but could be <button>, <section>, <header>, <nav>, or <article> depending on semantic meaning). Therefore, using the minimum necessary frames helps developers create cleaner, more maintainable code.
Semantic Frame Mapping
Best practices:
A simple button needs only three frames which wrapped by a container. These frames are used for start icon, button label, and end icon.
Those three frames translate directly to HTML and CSS as:
You can have more or less frames inside a container depending on the complexity of the component. For example, if you have a spinner for loading state, you can add a frame for the spinner.
Unnamed and named frame structure
Proper layer naming is essential for clear communication between designers and developers. Meaningful names help developers understand the purpose of each frame and how it maps to code. If you wouldn't name a CSS class "Frame 1" or "Group 2", don't use those names in your layers. Instead, use descriptive names that reflect the element's role.
Unnamed vs Meaningful Layer Names for a Card Component
Above example shows a card component with unnamed frames (left) versus thoughtfully named frames (right). The meaningful names clarify the structure and purpose of each element, making it easier for developers to implement the design accurately. Even the Figma icons tells the layout direction (horizontal vs vertical) at a glance.
Figma provides AI-powered layer naming if you prefer not to manually label frames. Learn more about using AI to rename layers in Figma.
Benefits of Thoughtful Layer Naming
Naming Conventions
Follow these guidelines when naming layers:
// Use clear, descriptive names 🟩 CardImage (not Image1) 🟩 CardTitle (not Text_Layer_2) 🟩 ActionButton (not Button) 🟩 IconWrapper (not Group_23) 🟩 PriceLabel (not Text)
// Do not use vague, generic names 🟥 Container 🟥 Wrapper 🟥 Group 🟥 Frame #123456 🟥 Text
Avoid using Rectangle and Ellipse in Figma since they do not translate to semantic HTML elements. Always use Frames with Auto-Layout for containers. Learn more about Groups vs Frames in Figma.
By combining proper Auto-Layout structure with meaningful layer names, you set your development team up for success. This will enable them to implement components quickly and accurately. Modern design systems like Material Design (Google), Carbon (IBM), and Atlassian Design System use consistent frame naming to create clarity across hundreds of components.
Properties of a sample button component in Figma
Component properties (props) are arguably Figma's most powerful feature for creating flexible, functional components that mirror real component behavior. As a designer, If I am going to use an UI element more than once, I always create a component with well-defined properties. This approach not only streamlines my design process but also significantly reduces the development effort required to implement the component. Defining properties is a time investment that pays off in spades.
Figma supports several property types that map directly to JavaScript/TypeScript:
Property types available in Figma
We can use these property types to create any UI component with different states and variants. Below is a table that maps Figma properties to frontend equivalents.
| Figma Property | Frontend Equivalent | Example Use Case |
|---|---|---|
| Text | string | Button labels, card titles, descriptions |
| Boolean | boolean | isDisabled, isLoading, hasIcon |
| Instance Swap | Component instance | Icon components, avatar images |
| Variant | string enum | type="primary", size="large" |
Table 1. Mapping Figma Properties to Frontend Equivalents
Front-end development has been around for a long time. Over the years, certain conventions have emerged that enhance code readability and maintainability. Adopting these conventions in your property naming can significantly improve collaboration with developers. As designers, we should strive to speak the same language as our developer counterparts. Here are some key conventions to consider:
Property naming conventions
While naming properties, consider giving meaningful names that convey the purpose of the property. Following front-end conventions can help maintain consistency and clarity and it also reduce the development time. As an example, adding a ? at the end of boolean properties indicates that the property is optional which is a valuable info for the development team.
// Use descriptive, purposeful names 🟩 cardTitle 🟩 isDisabled 🟩 buttonLabel 🟩 iconStart 🟩 hasEndIcon 🟩 showKebabMenu
// Do not use vague, generic names 🟥 text1 🟥 disabled 🟥 label 🟥 icon 🟥 end 🟥 menu
Learn more about JavaScript naming conventions and best practices. Visit the W3Schools website for a comprehensive guide.
Figma component properties translate naturally across frameworks. Here's how a button component with well-named props looks in React (TypeScript):
Component property mapping between Figma and code
Above Figma button component properties map directly to props in React, Vue, Angular, and Svelte with minimal adjustments for framework syntax. This consistency reduces cognitive load for developers and help them implement components faster and with fewer errors. Let's take a look at how the same properties look in different frameworks:
In React, component properties are defined in an interface.
In Vue, component properties are defined in an interface.
In Angular, component properties are defined in a class.
In Svelte, component properties are defined in a script tag.
As we can see, the same well-defined properties in Figma translate cleanly to props in React, Vue, Angular, and Svelte. This consistency not only speeds up development but also reduces the likelihood of miscommunication or errors during implementation. By investing time in defining clear, js-friendly component properties in Figma, we set the stage for a smoother handoff to developers and a more efficient development process overall.
A token, as used in web development and design, is typically a standardized value that denotes a particular configuration or design element. Tokens are frequently used to enhance scalability, preserve consistency, and promote cooperation across various libraries and frameworks.
Sample design tokens which point to a color hex value (#0D99FF), spacing in pixels (16px), font family (Space Grotesk), and border radius (8px).
Modern digital products require theme support (light mode, dark mode, high contrast). This necessitates tokens, or customization features using variables instead of hard-coded values. Besides that, using tokens instead of fixed values also enables scalability and consistency across the design system. For example, if your brand color changes, updating a single token updates it everywhere. As designers, we often hear new iteration ideas from stakeholders. Using tokens allows us to implement changes quickly without touching every component.
From Hard-Coded Values to Design Tokens
If you are using CSS, SASS, or CSS-in-JS, design tokens are typically implemented as CSS variables (custom properties). You need to create your own primitive and component tokens. If you want to skip the creating primitive tokens, it's best to use an existing library like TailwindCSS. It provides a comprehensive set of design tokens that cover colors, spacing, typography, and more. You can then create component-specific tokens that reference these primitives. For example, a button's primary background color token might reference Tailwind's `--tw-color-blue-600`. Here is an example of how to transition from old way to modern way:
// Old approach (hard-coded values) 🟥 Color: "#0D99FF" (specific hex value) 🟥 Spacing: "16px" (specific pixel value) 🟥 Font: "Inter" (specific typeface) 🟥 Border radius: "8px" (specific value)
// Modern approach (design tokens) 🟩 Color: "--color-primary-600" → resolves to "#0D99FF" in light mode, "#3B82F6" in dark mode 🟩 Spacing: "--spacing-4" → resolves to "16px" (or "1rem" in fluid systems) 🟩 Font: "--font-family-sans" → resolves to "Inter, system-ui, sans-serif" 🟩 Border radius: "--radius-md" → resolves to "8px"
Benefits of Tokens
Examples for basic design tokens for a button component
A design token is a standardized, reusable variable that stores design values like colors, spacing, or typography so they can be easily accessed across different platforms and technologies. Design tokens maintain consistency and help designers and developers collaborate more effectively. We can define various types of tokens for different purposes. For example, we can define color tokens for different purposes like primary, secondary, success, error, etc.
Tokens have various layers of abstraction, from primitive tokens to component tokens to application tokens.
Examples for design tokens levels from primitive to component to application.
Design tokens are simple to incorporate into component libraries, style guides, and design systems because they are usually stored in a format like JSON, YAML, or XML. They can be employed in a variety of frameworks and tools, frequently with the aid of design token management tools or preprocessors like Sass.
Managing design tokens is a crucial part of components and design systems maintenance. You can use various tools to manage design tokens like Tokens Studio, Specify, and Supernova.
Tokens Studio is the designer's favorite, native Figma integration with powerful Graph Engine for complex logic.
Specify is the automation powerhouse perfect for teams that need reliable, customizable token distribution. It's sad that it doesn't have a free plan.
Supernova is the enterprise solution to complete design system management platform with documentation and automation.
Primitive level color token examples
Figma allows us to define various tokens through its Variables feature with four different types: Color, Number, String, and Boolean. Using these tokens improves design system maintenance, ensures consistency across the interface, eases style updates, and enables various theme modes such as dark-light mode.
Variable types available in Figma
These different types of tokens can be used in various ways to define style properties while designing components, elements, templates, pages, and more:
To get started using variables in Figma, open Variables panel via right sidebar and create a "Collection" in the Variables window. Each file has its own variables yet you can publish them via a team library. You can also move tokens between design files by copying and pasting.
Placement of the Variables
Once you have created a collection, you can add variables to it by clicking the "Create Variable" button. You can also add variables to a collection by copying and pasting them from another collection.
Example of variable usage
After defining the variables, you can start to use them in every aspect of your design system. You can use color-body-text-primary to all your body text elements. This will allow you to easily change the color of your body text by changing the value of the related color variable.
Using tokens for width, height, gap, and padding
You can also use tokens for width, height, gap, and padding of your components. This will allow you to easily change the size of your components by changing the value of the related token.
Prototyping is one of the must-haves for delivering a production-ready component. It allows us to mimic real-time behaviors for actionable items. Today most UI elements have interactions. At least, a hover state is applicable for most of them. For instance, a button can redirect users to a different page, display a dialog, or open a drawer on the side. Adding an On Click event into a component in Figma actually helps developers while defining the “onClick” function on the component so they can define proper destination for the component.
Button with hover and onClick actions
Various triggers and actions are available in Figma's prototype capabilities. Page transitions can be defined using triggering overlays, which are primarily utilized for drawers, dialog, and modals, as well as animations and destinations, which aid in defining navigation. We can simulate items that function just like we developed them by using component-level prototyping. When a component has interactions, developers can see those actions via Dev Mode in Figma, VS Code, or Cursor.
Interaction configurations for hover trigger
Additionally, adding component interactions reveals the component's faults during the early stages of design. Configuring user flows is made possible by the usage of interactive components rather than static ones. Additionally, it is necessary for the initial testing of prototypes. If you conduct a usability test, you can use the prototype to test the user flows and interactions. Last but not least of the benefits is having interactive elements enables stakeholders to understand better while you are doing your presentations.
Almost all of the components need to define various states. Every state serves a distinct function in displaying a component's status. While a hover state provides visual input regarding the interactivity, a default state displays the component's initial appearance. The cursor pointer's appearance may indicate that a component is draggable or contains an anchor link that will take us to a different location.
Button component with default, hover, focus, loading, and disabled states
Any interactive component needs to exhibit these fundamental states; Default, Hover, Focus, Active, Disabled, Loading, Error, Success. Let's take a look at each state in detail with using an input component as an example.
Default State
Default state of an input component
Hover State
Hover state of an input component
Focus State
Focus state of an input component
Active/Pressed State
Active state of an input component
Disabled State
Disabled state of an input component
Loading State
Loading state of an input component
Error State
Error state of an input component
Success State
Success state of an input component
Changing states of a component or assigning an onclick function requires defining triggers and actions. Figma offers various triggers and actions for both web and mobile experiences. To create an interactive component and functional interface in the design phase, you need to use triggers and actions functionality.
Interaction flow for a component
Triggers
You can designate ten distinct triggers for your components in Figma. These triggers can be used to assign keyboard keys, click and drag, move the mouse pointer over an element, or delay a transition. The two triggers that designers use the most while designing are On Click and While Hovering. On Tap and On Drag might be your top picks if you're designing for mobile.
Trigger types available in Figma
Actions
Actions are the functions that are executed when a trigger is activated. You can designate eleven distinct actions for your components in Figma. These actions define the behavior of the component when a trigger is activated.
Action types available in Figma
Most common actions when designing components and pages are Navigate, Scrool, Open, and Open Overlay. If you need to define complex behavior, you can use the Conditional, Set Variable, and Set Variable Mode. Conditional action type allows you to define IF/ELSE logic. Set Variable action type allows you to set a variable value. Set Variable Mode action type allows you to switch between different modes of a variable such as light mode, dark mode, and high contrast mode.
Defining an On Click action on a button component to navigate user to pricing page
The principles outlined in this article, Structure, Properties, Tokens, andInteractions, are essential for creating components that are easy to implement in code. When you structure frames with HTML in mind, name properties using proper conventions, implement design tokens for scalability, and prototype complete interaction states, you're not just creating better Figma files. You're building bridges between disciplines.
If you start to implement these principles, you will see the benefits like:
Bridge between design and development
Beyond Individual Components
While this article focused on component design, these principles extend far beyond single UI elements:
The job market data shows this clearly: 20% of product designer positions now requires front-end development knowledge. This isn't a passing trend. It's the evolution of our discipline. Designers who understand code structure, component architecture, and developer workflows are becoming increasingly valuable.
Starting Tomorrow
You don't need to master everything at once. Start small:
This week:
This month:
This quarter:
Your learning journey
Small, consistent improvements compound into expertise. Each component you refine teaches you more about the design-development relationship. Do not forget: The best components aren't just beautiful. They are thoughtfully structured, clearly documented, and ready to become excellent in development.
A Final Thought
The best designs aren't the ones that look most impressive in Figma presentations. They're the ones that successfully navigate the journey from concept to production, maintaining their integrity, meeting user needs, and respecting technical constraints along the way.
By mastering component design for JavaScript frameworks, you're not just becoming a better designer. You're becoming a more effective collaborator, a more valuable team member, and a more complete product professional. You're learning to speak multiple languages fluently. The visual language of design and the logical language of code. Use both to create experiences that truly work.
This story ends here yet the journey continues...
In this article