Skip to Content
Prisma UI - React component library
ComponentsComponentsButton

Button

A versatile button component built on top of Radix UI and styled with Tailwind CSS. Supports multiple variants, sizes, visual effects, icons, and loading states.

Installation

npx shadcn@latest add https://prismaui.com/components/button.json

Import

import { Button } from '@/components/ui/button';

Variants

The variant prop controls the visual style of the button.

<Button variant="default">Default</Button> <Button variant="destructive">Destructive</Button> <Button variant="outline">Outline</Button> <Button variant="secondary">Secondary</Button> <Button variant="ghost">Ghost</Button> <Button variant="link">Link</Button>
VariantDescription
defaultPrimary button with solid background
destructiveFor dangerous or destructive actions
outlineBordered button with transparent fill
secondarySubtle, less prominent button
ghostNo background until hovered
linkStyled as a text link with underline

Sizes

The size prop controls the dimensions of the button.

<Button size="xs">Extra Small</Button> <Button size="sm">Small</Button> <Button size="default">Default</Button> <Button size="lg">Large</Button>

Icon Sizes

For icon-only buttons, use the icon size variants.

import { Plus } from 'lucide-react'; <Button size="icon-xs"><Plus /></Button> <Button size="icon-sm"><Plus /></Button> <Button size="icon"><Plus /></Button> <Button size="icon-lg"><Plus /></Button>
SizeDescription
defaultStandard height (36px)
xsExtra small
smSmall
lgLarge
iconSquare button for icons
icon-xsExtra small icon button
icon-smSmall icon button
icon-lgLarge icon button

Effects

The effect prop adds visual animations and transitions to the button.

Shine

A continuous animated shine sweeping across the button.

<Button effect="shine">Shine</Button> <Button variant="destructive" effect="shine">Shine Destructive</Button> <Button variant="secondary" effect="shine">Shine Secondary</Button>

Shine Hover

Shine effect that triggers only on hover.

<Button effect="shineHover">Shine Hover</Button> <Button variant="destructive" effect="shineHover">Shine Hover</Button> <Button variant="secondary" effect="shineHover">Shine Hover</Button>

Ring Hover

Displays a colored ring around the button on hover.

<Button effect="ringHover">Ring Hover</Button> <Button variant="destructive" effect="ringHover">Ring Hover</Button> <Button variant="outline" effect="ringHover">Ring Hover</Button>

Gooey Right / Gooey Left

A fluid gooey animation sweeping from right or left on hover.

<Button effect="gooeyRight">Gooey Right</Button> <Button effect="gooeyLeft">Gooey Left</Button> <Button effect="gooeyRight" variant="destructive">Gooey Right</Button> <Button effect="gooeyLeft" variant="destructive">Gooey Left</Button>

Expand Icon

An icon that expands from hidden on hover. Requires icon and iconPlacement props.

import { ArrowRight, ChevronRight, Mail } from 'lucide-react'; <Button effect="expandIcon" icon={ArrowRight} iconPlacement="right"> Continue </Button> <Button effect="expandIcon" icon={ChevronRight} iconPlacement="right" variant="outline"> Next Step </Button> <Button effect="expandIcon" icon={Mail} iconPlacement="left"> Send Email </Button>

Underline / Hover Underline

Underline animations for link-style buttons.

<Button variant="link" effect="underline">Underline</Button> <Button variant="link" effect="hoverUnderline">Hover Underline</Button>

Pulsating

A continuous pulsating glow effect.

<Button effect="pulsating">Pulsating</Button> <Button variant="destructive" effect="pulsating">Pulsating</Button>

Rainbow

An animated rainbow gradient border effect.

<Button effect="rainbow">Rainbow</Button> <Button size="lg" effect="rainbow">Rainbow Large</Button>
EffectDescription
shineContinuous animated shine
shineHoverShine triggered on hover
ringHoverColored ring on hover
gooeyRightFluid gooey animation from right
gooeyLeftFluid gooey animation from left
expandIconIcon expands on hover
underlineUnderline that disappears on hover
hoverUnderlineUnderline that appears on hover
pulsatingContinuous pulsating glow
rainbowAnimated rainbow gradient border

With Icons

Place icon components directly as children of the button.

import { Mail, Download, Trash2, Heart, Search, ArrowRight } from 'lucide-react'; <Button><Mail /> Send Email</Button> <Button variant="outline"><Download /> Download</Button> <Button variant="destructive"><Trash2 /> Delete</Button> <Button variant="secondary"><Heart /> Favorite</Button> <Button variant="ghost"><Search /> Search</Button> <Button>Next <ArrowRight /></Button>

Loading State

Set loading to show a spinner and disable the button.

<Button loading>Saving...</Button> <Button loading variant="destructive">Deleting...</Button> <Button loading variant="outline">Loading...</Button> <Button loading size="icon" /> <Button loading size="icon-sm" />

Disabled State

<Button disabled>Disabled</Button> <Button disabled variant="destructive">Disabled</Button> <Button disabled variant="outline">Disabled</Button> <Button disabled variant="secondary">Disabled</Button>

As Child

Use asChild to render the button styles on a different element, such as an anchor or Next.js Link.

import Link from 'next/link'; <Button asChild variant="link"> <Link href="/docs">Go to Docs</Link> </Button> <Button asChild> <a href="https://github.com" target="_blank" rel="noopener noreferrer"> GitHub </a> </Button>

API Reference

PropTypeDefaultDescription
variant"default" | "destructive" | "outline" | "secondary" | "ghost" | "link""default"Visual style of the button
size"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg""default"Size of the button
effect"shine" | "shineHover" | "ringHover" | "gooeyRight" | "gooeyLeft" | "expandIcon" | "underline" | "hoverUnderline" | "pulsating" | "rainbow"undefinedVisual effect applied to the button
iconReact.ElementTypeundefinedIcon component to render
iconPlacement"left" | "right"undefinedPosition of the icon
loadingbooleanfalseShows a spinner and disables the button
asChildbooleanfalseRenders as child element via Radix Slot
disabledbooleanfalseDisables the button
classNamestringundefinedAdditional CSS classes
Last updated on