COMPONENT · 01

Button

7 style variants, 7 intent colors, elevated and glow effects, a loading state with spinner, icons, and tooltip.

  • @ui-sdk/react
  • class-variance-authority
  • lucide-react

Preview

Colors

Sizes

padding sets the padding and a matching text size.

Radius

Text size

textSize changes the text size on its own, keeping the padding.

Icon size

States

Glow

effect="glow" adds a glow in the button's own color. Use one effect at a time.

Icons

Icon only

An icon-only button has no visible text, so give it a name with aria-label or tooltip.

With tooltip

Responsive

Resize the window below 640px to see the effect.

Custom styles

iconClassName and textClassName style the icon and the text separately, without losing the variant.

Installation

npx shadcn@latest add https://lanzate-ui.vercel.app/r/button.json

Usage

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

// Default
<Button>Take off</Button>

// Variant and color
<Button variant="outline" color="success">
  Confirmed
</Button>

// Icon and loading state
<Button isLoading={isPending} loadingText="Saving..." startIcon={<Save />}>
  Save
</Button>

// Elevated, with a tooltip
<Button effect="elevated" tooltip="Main action">
  Publish
</Button>

// As a link
<Button render={<a href="/docs" />}>Read the docs</Button>

API

PropTypeDefaultDescription
variant"solid" | "outline" | "ghost" | "soft" | "dashed" | "subtle" | "surface""solid"Visual style.
color"primary" | "secondary" | "muted" | "info" | "warning" | "success" | "error""primary"Intent color, from the design tokens.
effect"none" | "elevated" | "glow""none"Depth treatment: a drop shadow, or a glow in the button's color. One at a time.
padding"none" | "xs" | "sm" | "base" | "md" | "lg" | "xl""base"Padding and text size.
radius"none" | "sm" | "md" | "lg" | "xl" | "full""md"Corner radius.
textSize"xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "display"Text size independent of padding.
iconSize"xs" | "sm" | "base" | "md" | "lg" | "xl"Icon size relative to the text.
startIconReactNodeIcon before the text.
endIconReactNodeIcon after the text.
iconReactNodeIcon-only, square button. Name it with `aria-label` or `tooltip`.
isLoadingbooleanfalseShows a spinner, disables the button and marks it busy.
loadingTextstringReplaces the label while loading.
tooltipReactNodeWraps the button in a Tooltip. A disabled button with a tooltip stays focusable.
tapAnimationbooleantrueScales down slightly on press.
mobile"only-icon" | "full-width" | "hidden"Behavior below the `sm` breakpoint. `only-icon` hides the label (kept for screen readers) and makes the button square, like an icon-only one.
renderReactElementRenders another element, like a link: render={<a href="/docs" />}.
classNamestringClasses for the root element, merged after the variants.
iconClassNamestringClasses for the icon wrapper (startIcon, endIcon, icon).
textClassNamestringClasses for the text wrapper (children or loadingText).