UI / UXDesign SystemsDiagramIntermediate
Component Variants
KO: 컴포넌트 변형 (Component Variants)·EN: Component Variants·JA: コンポーネントバリアント
Structuring a reusable UI component around orthogonal axes—such as intent, size, and state—to cover every visual permutation without duplicating code
Table of Contents
Structure Diagram
Orthogonal Variant Matrix for a Button ComponentTap a node
ROOT<Button /> Primitive
3 linksQuick Answer
What is Component Variants?
Structuring a reusable UI component around orthogonal axes—such as intent, size, and state—to cover every visual permutation without duplicating code. It is a core concept in Design Systems within UI / UX.
Core Principles
Instead of spawning separate files like SmallRedButton or OutlineLargeButton, Component Variants model one reusable primitive along orthogonal axes—such as variant (visual intent), size, and state.
Mirroring these axes 1:1 between Figma Component Properties and code utilities (like CVA / Tailwind Variants) creates a predictable, type-safe API that scales cleanly across large teams.
Practical Takeaways
- Replace conflicting booleans with enums: Mutually exclusive flags like
isPrimaryandisGhostallow impossible states when passed together. Consolidate them into one typed union:variant="primary" | "secondary" | "ghost" | "destructive". - Name by intent, not raw color: Prefer
tone="danger"orvariant="destructive"overcolor="red"so brand palette shifts never break component APIs. - Prevent combinatorial explosion: Keep variant matrices lean by using boolean/slot props for icons or loading spinners, and handle rare edge intersections with compound variants.
Notable Examples
- shadcn/ui + Class Variance Authority (CVA): Declarative
variantandsizematrices with automatic TypeScript prop inference. - Figma-to-React property parity: Matching Figma Variant names directly to React props for frictionless handoff.
- Semantic Alert & Badge tones: Bundling colors, icons, and contrast rules under
info | success | warning | error.