VariantProps

A TypeScript helper from CVA that extracts a component's prop types from its cva() definition.

In more detail

type ButtonProps = VariantProps<typeof button> gives intent?: "primary" | "danger" and size?: "sm" | "lg" automatically. Adding a variant then updates the props with no second list to keep in sync.

Related terms

Taught in

References