Conditional styling
To apply styles conditionally, you can use the base
, variants
and compoundVariants
keys inside the corresponding component’s config element key.
Base
Allows you to apply classes consistently, reducing code duplication in variants
and compoundVariants
.
Variants
Allows you to conditionally apply classes based on individual prop values. There is no limit to the number of variants you can define.
Compound Variants
Sometimes you might want to add a variant that depends on another variant. For example, you might want to add a color
variant that depends on the disabled
variant. This is possible by using the compoundVariants
key.
There is no limit to the number of compound variants and props inside you can define.
Note that the compoundVariants
key always is an array of objects.
Last updated