Component variants

On this page 7

Component variants are the related versions of a single reusable component, such as a button in primary, secondary and destructive styles or in small, medium and large sizes, that are grouped together and selected through named properties instead of being maintained as separate components. In Design, and particularly in the design workflow of interface teams, variants are the mechanism that keeps a component library compact, predictable and aligned with code.

The idea is that one component holds every legitimate permutation. A designer places the component and chooses values such as Size=Large and State=Disabled, and the tool swaps in the matching version while preserving overrides like label text.

How component variants are structured

A variant set is organized as a matrix of properties and values. Each property describes one dimension of difference, and each value is an allowed option along that dimension. A button with three types, three sizes and four states therefore defines up to 36 combinations, each one a concrete variant inside the same component set.

Design tools such as Figma, Sketch and Penpot implement this idea with slightly different terms, but the logic is the same: a parent component set contains child variants, and every child is identified by its property values. Instances placed in screens reference the set, so a change to a variant propagates to every instance that uses it.

The table below lists the property types most teams use and the kind of difference each one captures.

Property typeExample valuesWhat it changes
Type or emphasisPrimary, secondary, tertiaryVisual weight and color
SizeSmall, medium, largeDimensions, padding, font size
Interaction stateDefault, hover, pressed, disabledFeedback to user actions
Validation statusNeutral, error, successBorder color and helper text
Layout or orientationHorizontal, verticalArrangement of internal parts
Theme or modeLight, darkSurface and text colors
Common variant property types

Variants are often confused with neighboring concepts because several mechanisms can express the same difference. Modern tools add boolean properties to show or hide layers, text properties to edit labels and instance-swap properties to replace nested icons. Design tokens and variables handle values like color and spacing at a lower level.

Choosing the right mechanism keeps the variant matrix small. A good rule is that variants express structural or visual differences, while simple toggles and content belong in other property types.

MechanismBest forExample
Variant propertyDistinct visual or structural versionsPrimary versus ghost button
Boolean propertyShowing or hiding one layerIcon on or off
Text propertyEditable contentButton label
Instance swapReplacing a nested componentChoosing which icon appears
Design tokens or variablesShared values across componentsBrand color, spacing scale
Variants compared with related mechanisms

Naming and mapping variants to code

Variant properties are most valuable when they mirror the props of the coded component. If the React or Vue button accepts variant, size and disabled, the design component should expose the same names and values. This alignment shortens developer handoff, because engineers can read the property panel or an inspection tool and map it directly to code.

Consistent naming also matters for search and automation. Teams usually adopt a fixed property vocabulary across the library, with values written the same way everywhere, for example always Size=Small rather than mixing sm, S and Small. Plugins and design-to-code tools rely on this regularity.

The following table shows how variant properties typically correspond to component props.

Design propertyCode propNote
Type=Primaryvariant=”primary”Same value names on both sides
Size=Largesize=”lg”Agree on one abbreviation scheme
State=Disableddisabled={true}State is a boolean in code
State=HoverNo propHandled by CSS pseudo-classes
Icon=Trueicon prop presentBoolean property, not variant
Mapping variant properties to code props

The hover row illustrates an important nuance: some variants exist only for documentation. Interaction states like hover and focus are drawn in the design file so reviewers can check them, but in code they emerge from CSS rather than from a prop.

Keeping variant sets manageable

The main risk with variants is combinatorial explosion. Every new property multiplies the number of combinations, and a set with 200 variants becomes slow to load, hard to audit and confusing to use. Experienced design system teams therefore limit each set to the combinations that are actually valid in the product.

Useful practices include splitting a sprawling set into separate components with clear purposes, moving optional elements to boolean properties, and leaving out impossible combinations such as a disabled button in a pressed state. Auto layout inside each variant keeps sizes consistent when labels change.

SymptomLikely causeFix
Hundreds of variants in one setToo many properties combinedSplit into focused components
Overrides lost when swappingInconsistent layer namesUse identical layer structure
Designers detach instancesMissing needed optionAdd the variant or a property
Mismatch with coded componentDivergent namingAlign properties with props
Invalid combinations in mockupsUnrestricted matrixRemove impossible variants
Symptoms of poorly managed variants

Benefits and limitations in daily work

Variants deliver faster screen assembly, fewer duplicate components and more consistent interfaces. Swapping a property is quicker than searching a library, and a single source makes design QA simpler, because reviewers can confirm that each screen uses approved versions.

  • Overrides survive swaps only when layer names and structure match across variants.
  • Large sets affect performance in the design file and in published libraries.
  • Variants do not replace documentation; usage guidance still explains when each version applies.
  • Version history and change logs matter, because editing a variant updates every instance in every file that uses the library.

The simple explanation

Think of component variants as one product sold in several options, like a T-shirt that comes in different sizes and colors. Instead of keeping each option in a separate box, the store keeps them on one rack and you simply pick the size and color you need.

In interface design, a button or input field works the same way. Designers keep all approved versions in one place and choose the right one from a short menu. That keeps every screen consistent and makes it easy for developers to build exactly what was designed.

How it is used in practice

A design system team at a mid-sized online banking provider finds that its library contains 48 separate button components created by different designers over several years. Many differ only by a few pixels, and developers regularly ask which one is correct.

The team rebuilds the button as one component set with three properties: Type with primary, secondary and danger; Size with small, medium and large; and State with default, hover, focus and disabled. Icons become a boolean property and an instance swap rather than additional variants, so the set contains 36 variants instead of well over a hundred. The property names match the props of the coded button exactly.

Within one quarter, design QA finds far fewer inconsistent buttons in new features, and handoff questions about button styles nearly disappear. The outcome demonstrates how carefully scoped component variants reduce both visual drift and communication overhead.