Button

Highly interactive button component with support for multiple variants, sizes, and states.

Installation

bash
npx canx-ui add button

Usage

tsx
import { Button } from "@/components/ui/button";

export default function Demo() {
  return (
    <div className="flex flex-wrap gap-4">
      <Button variant="default">Default</Button>
      <Button variant="secondary">Secondary</Button>
      <Button variant="destructive">Destructive</Button>
      <Button variant="outline">Outline</Button>
      <Button variant="ghost">Ghost</Button>
      <Button variant="link">Link</Button>
    </div>
  );
}

Props

PropTypeDefaultDescription
variant"primary" | "secondary" | "destructive" | "outline" | "ghost" | "link""default"Visual style of the button.
size"default" | "sm" | "lg" | "icon""default"Size of the button.
asChildbooleanfalseMerge props onto the immediate child.