To build maintainable and scalable recipes for your components, it's important to understand how to create a recipe from component variations.
There are four properties of a recipe:
Here's an example of a button recipe.
import { cva } from '../styled-system/css'
const button = cva({
base: {
display: 'flex',
},
variants: {
visual: {
solid: { bg: 'red.200', color: 'white' },
outline: { borderWidth: '1px', borderColor: 'red.200' },
},
size: {
sm: { padding: '4', fontSize: '12px' },
lg: { padding: '8', fontSize: '24px' },
},
},
compoundVariants: [
{
size: 'small',
visual: 'solid',
css: {
border: '2px solid blue',
},
},
],
defaultVariants: {
visual: 'solid',
size: 'lg',
},
})