Design - Component Variables
Using Variables in Figma Components
How to use variables in Figma components for consistent styling.
Applying variables to components
Color variables
Apply color variables to component fills and strokes:
- Select component layer
- Open fill/stroke panel
- Click variable icon
- Select color variable
- Verify variable applies correctly
Spacing variables
Apply spacing variables to component padding and gaps:
- Select component frame
- Open auto layout settings
- Set padding using spacing variable
- Set gap using spacing variable
- Verify spacing applies correctly
Typography variables
Apply typography variables to text layers:
- Select text layer
- Open text style settings
- Set font family using typography variable
- Set font size using typography variable
- Set font weight using typography variable
Component variable patterns
Pattern 1: Direct variable usage
Use semantic variables directly in components:
- Button background:
color/surface/brand - Button text:
color/text/on-brand - Button padding:
spacing/component/button/padding
Pattern 2: Component-specific variables
Use component-specific variables:
- Button background:
component/button/color/background/default - Button text:
component/button/color/text/default - Button padding:
component/button/spacing/padding
Pattern 3: Variable overrides
Allow variable overrides for component variants:
- Default:
component/button/color/background/default - Hover:
component/button/color/background/hover - Disabled:
component/button/color/background/disabled
Examples
Button component
Button component using variables:
- Background:
color/surface/brand - Text:
color/text/on-brand - Padding:
spacing/component/button/padding - Border radius:
radius/component/button
Input component
Input component using variables:
- Border:
color/border/default - Border focus:
color/border/focus - Padding:
spacing/component/input/padding - Text:
color/text/primary
Card component
Card component using variables:
- Background:
color/surface/default - Border:
color/border/default - Padding:
spacing/component/card/padding - Shadow:
shadow/card
Implementation rules
- Use semantic variables in components
- Create component-specific variables when needed
- Use variable overrides for variants
- Document variable usage
- Test variable changes
Failure modes
If component variables are wrong:
- Hardcoded values in components
- Inconsistent styling
- Maintenance burden
- No customization options
Out of scope
- Component creation (see Figma docs)
- Variable creation (see workflow docs)
- Component library structure (separate concern)