RFC feature description
Inspired by cva.
const button = cva({
base: "rounded border font-semibold",
// **or**
// base: ["font-semibold", "border", "rounded"],
variants: {
intent: {
primary: "border-transparent bg-blue-500 text-white hover:bg-blue-600",
// **or**
// primary: [
// "bg-blue-500",
// "text-white",
// "border-transparent",
// "hover:bg-blue-600",
// ],
secondary: "border-gray-400 bg-white text-gray-800 hover:bg-gray-100",
},
size: {
small: "px-2 py-1 text-sm",
medium: "px-4 py-2 text-base",
},
},
compoundVariants: ({ intent, size }) => [
{
condition: [intent.primary, size.medium],
class: "uppercase",
// **or** if you're a React.js user, `className` may feel more consistent:
// className: "uppercase"
},
],
defaultVariants: {
intent: "primary",
size: "medium",
},
});
button();
// => "font-semibold border rounded bg-blue-500 text-white border-transparent hover:bg-blue-600 text-base py-2 px-4 uppercase"
button({ intent: "secondary", size: "small" });
// => "font-semibold border rounded bg-white text-gray-800 border-gray-400 hover:bg-gray-100 text-sm py-1 px-2"
Related RFC
https://github.com/mincho-js/working-group/blob/main/text/006-class-name.md#3-variants
The solution I'd like
No response
Screenshots or video
No response
Alternatives I've considered
No response
Additional context
No response
RFC feature description
Inspired by cva.
Related RFC
https://github.com/mincho-js/working-group/blob/main/text/006-class-name.md#3-variants
The solution I'd like
No response
Screenshots or video
No response
Alternatives I've considered
No response
Additional context
No response