variant
A named option of a component, such as intent primary or danger and size sm or lg, each mapped to its own styling.
In more detail
Variants replace piles of boolean props: instead of isPrimary and isDanger (which can both be true), one intent prop allows exactly one value. Each variant axis is independent, so size and intent combine freely.
Related terms
- Class Variance Authority — A small JavaScript library that turns a component's variants, such as intent and size, into the right list of CSS classes.
- boolean prop — A component option that is just true or false, such as isPrimary or hasIcon.
- compoundVariants — A CVA option that adds classes only when a specific combination of variants is chosen, such as intent danger with size lg.
Taught in
- Class Variance Authority: Type-Safe Variant & Prop Orchestration — Design Systems & Component Engineering
- System Governance: Changesets, Semantic Versioning & Deprecation — Design Systems & Component Engineering