Why class-recipe
class-recipe solves the same problem as class-variance-authority and tailwind-variants: turning component props into class names. It differs from them in these ways:
class-recipe 1.2.0 |
class-variance-authority 0.7.1 |
tailwind-variants 3.3.1, lite |
|
|---|---|---|---|
| Slots | Yes | No | Yes |
| Variant without a default | Required by its type | Optional | Optional |
| Conflict resolution | Any join function, cached | Call twMerge on the result |
tailwind-merge, built in |
| Extending a recipe | Spread a shared config | No | extend |
| Recipe calls per second | 13.6 million | 1.5 million | 1.0 million |
The calls per second come from the benchmarks.
To move recipes over, see Migrating from class-variance-authority and Migrating from tailwind-variants.