TypeScript
const buttonVariants = svd({ variants: { size: { sm: "px-3 py-1.5 text-sm", md: "px-4 py-2 text-base", lg: "px-6 py-3 text-lg", }, // More variants... }, defaultVariants: { size: "md", }, }); const styles = buttonVariants({ size: "sm" });
SVDM is a multi-dimensional styling variance decomposition system in TypeScript that lets you define and manage style variations in a structured, scalable way. It is especially useful when you are building complex design systems, high-quality UI component libraries, or reusing configuration typings across many components.
SVDM takes a schema that describes your axes of variation — such as variant, size, or tone — and generates a function that maps variant selections to concrete styles. It is inspired by Class Variance Authority (CVA) and extends that idea to handle more complex, multi-dimensional variance spaces, while staying compatible with familiar CVA-style usage.
To dive deeper, use the other pages in this section for installation steps, TypeScript typing details, practical use case snippets, and examples of how to use SVDM in React UI components.
© 2025 Lingxi Li.
San FranciscoSF