An open source design system that's fully customizable and agent ready
TypeScript
// Copyright (c) Meta Platforms, Inc. and affiliates.
import type {ButtonHTMLAttributes} from 'react';
import {cn} from '@/lib/utils';
type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
variant?: 'default' | 'secondary' | 'outline' | 'destructive';
};
const variants = {
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
outline:
'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
destructive: 'bg-destructive text-white hover:bg-destructive/90',
};
export function Button({
className,
variant = 'default',
...props
}: ButtonProps) {
return (
<button
className={cn(
'inline-flex h-9 items-center justify-center rounded-md px-4 text-sm font-medium shadow-xs outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50',
variants[variant],
className,
)}
{...props}
/>
);
}