Forms
Button
Primary action trigger. 5 variants, 3 sizes, asChild.
Sourcebutton.tsx
Primitive
@radix-ui/react-slot
Variants
Five variants for different emphasis levels.
Sizes
Three sizes plus an icon-only variant.
With Icons
Icon slots on left and/or right side. Pass any SVG or icon component.
Loading State
Set loading=true to show a spinner and disable the button.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "primary" | "secondary" | "tertiary" | "destructive" | "ghost" | "primary" | Visual style variant. |
size | "sm" | "md" | "lg" | "icon" | "md" | Size preset. |
asChild | boolean | false | Render as child element using Radix Slot. |
loading | boolean | false | Show spinner. Replaces iconLeft if present, otherwise overlays label. |
iconLeft | ReactNode | -- | Icon rendered before the label. Replaced by spinner when loading. |
iconRight | ReactNode | -- | Icon rendered after the label. Hidden when loading. |
disabled | boolean | false | Disable the button. Also set automatically when loading. |
Related
Usage
import { Button } from "@doss/tetris-ui";