All Taste components
Buttons
Button
The main action and its quieter siblings, in three sizes, with an icon or without.
6 styles · 3 sizes · icon · disabled
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";
const button = cva(
"inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded font-medium transition active:scale-[.97] disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 [&_svg]:size-4",
{
variants: {
variant: {
primary: "bg-primary text-primary-fg hover:bg-primary-hover",
secondary: "bg-primary-soft text-primary-soft-fg hover:ring-1 hover:ring-ring",
outline: "border border-border-strong bg-bg text-fg hover:bg-surface",
ghost: "text-fg hover:bg-surface-2",
danger: "bg-danger text-bg",
link: "h-auto px-0 text-primary underline underline-offset-4",
},
size: { sm: "h-8 px-2.5 text-[13px]", md: "h-9 px-3.5 text-sm", lg: "h-11 px-5 text-[15px]", icon: "size-9" },
},
defaultVariants: { variant: "primary", size: "md" },
},
);
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof button> {}
export function Button({ className, variant, size, ...props }: ButtonProps) {
return <button className={cn(button({ variant, size }), className)} {...props} />;
}
The code uses the Taste Tailwind preset. Make yours on the Taste page with Export my system.