Documentation

Button

An animated button with variants, sizes, and support for leading and trailing icons.

Variants

Trailing icon

Leading icon

Sizes

Icon only

Installation

Initialize your project once, then add Button. The CLI copies the source and installs its dependencies.

bunx knot-ui initbunx knot-ui add button

Usage

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

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

Props

Component properties
PropTypeDefaultDescription
variant"default" | "secondary" | "outline" | "ghost" | "destructive""default"The visual style of the button.
size"sm" | "md" | "lg" | "icon""md"The dimensions and spacing of the button.
pressScalenumber0.96The scale while pressing. Reduced motion disables this animation.
classNamestring—Additional Tailwind classes.
childrenReactNode—The button label and optional icons.

Standard button attributes and Motion button properties are supported. Give icon-only buttons an accessible label.