Button

A button component with multiple variants, sizes, and loading state.

Installation

bash
npx @smicolon/cli add button

Run init once per project before adding components. See Installation.

Preview

Variants

Sizes

Loading

Props

PropTypeDefaultDescription
variant"default" | "destructive" | "outline" | "secondary" | "ghost" | "link""default"The visual style of the button.
size"default" | "sm" | "lg" | "icon""default"The size of the button.
loadingbooleanfalseShows a loading spinner.
loadingLabelstring"Loading"Screen-reader text while loading.
disabledbooleanfalseDisables the button.
asChildbooleanfalseRenders its child element instead.
onClick(event) => void—Called when the button is pressed.
classNamestring—Extra classes for the component.

Usage

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

export function Example() {
  return (
    <Button variant="default" size="default">
      Save changes
    </Button>
  )
}