Skip to content

Components

In Figma, a component is a piece of UI you define once and reuse everywhere. Swap the content, keep the style. In HTML and CSS, you do the same thing with classes. Define a .btn class once; apply it to every button on the page. Every button looks consistent — and when you change .btn, all of them update.

FigmaCSS
Component named Button/PrimaryClass .btn.btn--primary
Component named Button/SecondaryClass .btn.btn--secondary
Component named CardClass .card
Instance of Card<div class="card">...</div>
Component property (variant)Modifier class .btn--large

The naming convention most developers use is BEM — Block, Element, Modifier. The pattern:

  • Block: the component itself → .card
  • Element: a part of it → .card__title, .card__body
  • Modifier: a variant → .btn--primary, .btn--secondary

You do not need to memorize BEM. What matters is the idea: name your classes after what the thing is, not what it looks like. .card beats .white-rounded-box. .btn--primary beats .purple-button.

Below are two button variants and two card instances — all built from the same CSS classes. Click into the code and add a third card or a third button.

Notice both cards use the exact same .card, .card__title, and .card__body classes — only the content differs. This is the component model in HTML and CSS.

  • Creating a component in Figma without thinking through the states it actually needs (hover, disabled, loading, error)
  • Changing the main component but not updating every instance to match — developers hit the exact same problem with a shared component in code

Designers see “one component, several variants,” but developers see the same component and have to write code that covers every state that can actually happen, not just the ones that got designed.

💡 Real-world example

Atlassian’s design system documents each button’s real states — default, disabled, selected, loading — matching the exact states its code component implements. (Atlassian Design System: Button)

In CSS, what makes a style rule "reusable" across multiple elements?
Which Figma concept is most similar to a CSS class?
BEM naming convention uses what separator between block and element?