Class Map Example
unknown
tsx
2 months ago
347 B
61
No Index
import clsx from "clsx";
const classes = {
sm: "text-sm px-2 py-1",
md: "text-base px-4 py-2",
lg: "text-lg px-6 py-3",
};
interface ButtonProps {
variant: keyof typeof classes;
className?: string;
}
const Button = ({ variant, className }: ButtonProps) => {
return <button className={clsx(classes[variant], className)}>Button</button>;
};Editor is loading...
Leave a Comment