Command Palette

Search for a command to run...

Docs
Button

Button

Displays a button or a component that looks like a button.

Installation

Run the following command:

Update your imports:
import { Button } from "@/components/ui/button"

Usage

import { Button } from "@/components/ui/button";
 
export default function Home() {
  return (
    <Button>Click me</Button>
  );
}

Props

PropTypeDefaultDescription
variantdefault | destructive | outline | secondary | ghost | linkdefaultButton style variant
effectexpandIcon | ringHover | ringHoverOutline | shine | shineHover | gooeyRight | gooeyLeft | underline | hoverUnderline-Special effect applied to the button
sizeicon | xs | sm | md | default | lg | xl | 2xldefaultSize of the button
asChildbooleanfalseRender as a child component
IconReact.ElementType-Icon component to display
iconPlacementleft | right-Position of the icon relative to the text

HTML & Radix UI Props

The Button component uses Radix UI's Slot primitive and supports:

HTML Attributes

Standard HTML button attributes:
  • onClick
  • disabled
  • type (button, submit, reset)
  • form
  • formAction
  • name
  • value
  • aria-* attributes
  • data-* attributes
  • Event handlers like onMouseEnter, onFocus, etc.
The Button component ensures proper accessibility, keyboard navigation and semantic HTML.