HomeDocsComponentsBlocksChartsThemes
Introduction
  • Introduction
  • Installation
  • Themes
  • Artwork
  • llms.txt
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Brand SVG
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Upload
  • Form Guide
  • Hover Card
  • Icon Tile
  • Image Export
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • League Table
  • Marquee
  • Match Score
  • Meter
  • Multi Select
  • Native Select
  • Number Field
  • Pagination
  • Password Strength
  • Phone Input
  • Popover
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sonner
  • Sortable
  • Spinner
  • Stat
  • Stat Tabs
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
AI
  • Message Scroller
  • Message
  • Bubble
  • Marker
  • Attachment
  • Questionnaire
  • Composer
  • Reasoning
  • Tool Call
  • Approval Card
  • Citations
Blocks
  • Airtable
  • Airtable Kanban
  • CRM
  • ClickUp List
  • ClickUp Kanban
  • Repeatable Group
  • Command Palette
  • App Shell
  • Record Files
  • Settings Shell
  • Help Panel
  • Note Editor
  • Email Drafts
  • Task List
  • Notifications Panel
  • Dual Pane Sidebar
  • Team Members Panel
  • Mix Pack Builder
  • Record Picker and Date Quick-pick
  • Record List
  • Record Page
  • Sign In and Sign Up
  • Availability Scheduler
  • AI Chat
  • AI Assistant
  • Voice Message
  • Action Bar
  • Notion
  • Banking
  • Lineup Builder
  • Sports Score
  • Standings
  • Strava
  • Sheets
  • Notices
  • Settings
  • Billing
Templates
  • Sign In Page
  • Upload Page
  • Showcase Onboarding
  • Agreement Sign
  • Email
  • Email Composer
  • Share Dialog
  • Integrations
  • Transactions
  • Analytics
Utilities
  • motion
  • sounds
  • scroll-fade
  • shimmer
Another UI. Built on shadcn/ui with Phosphor icons.

Button

PreviousNext

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

UI SDKBase UIReact AriaRadix UI

Set "style": "aria-nova" in components.json. Customize in /create

import { ArrowUpIcon } from "@phosphor-icons/react"

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

Installation#

pnpm dlx shadcn@latest add https://anotherui.dev/r/button.json

Usage#

import { Button } from "@/components/ui/button"
<Button variant="outline">Button</Button>

Cursor#

Tailwind v4 switched from cursor: pointer to cursor: default for the button component.

If you want to keep the cursor: pointer behavior, add the following code to your CSS file:

You can also enable this during project setup with npx shadcn@latest init --pointer.

globals.css
@layer base {
  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }
}

Size#

Use the size prop to change the size of the button.

The sizes are 30, 34, 42 and 46px tall for xs, sm, default and lg, and the icon sizes are squares of the same heights. Input, Input Group, Select and Native Select take the same sizes, so controls of one size line up.

import { ArrowUpRightIcon } from "@phosphor-icons/react"

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

Default#

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

export function ButtonDefault() {

Outline#

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

export function ButtonOutline() {

Secondary#

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

export function ButtonSecondary() {

Ghost#

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

export function ButtonGhost() {

Destructive#

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

export function ButtonDestructive() {

Link#

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

export function ButtonLink() {

Icon#

import { ArrowCircleUpIcon } from "@phosphor-icons/react"

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

With Icon#

Remember to add the data-icon="inline-start" or data-icon="inline-end" attribute to the icon for the correct spacing.

import { GitBranchIcon, GitForkIcon } from "@phosphor-icons/react"

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

Rounded#

Use the rounded-full class to make the button rounded.

import { ArrowUpIcon } from "@phosphor-icons/react"

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

Spinner#

Render a <Spinner /> component inside the button to show a loading state. Remember to add the data-icon="inline-start" or data-icon="inline-end" attribute to the spinner for the correct spacing.

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

Button Group#

To create a button group, use the ButtonGroup component. See the Button Group documentation for more details.

"use client"

import * as React from "react"

As Link#

You can use the buttonVariants helper to make a link look like a button.

Do not use <Button> for links. The React Aria Button component always applies role="button", which overrides the semantic link role on <a> elements. Use buttonVariants with a plain <a> tag instead.

Login
"use client"

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

RTL#

To enable RTL support, see the RTL configuration guide.

"use client"

import { ArrowRightIcon, PlusIcon } from "@phosphor-icons/react"

API Reference#

Button#

The Button component is a wrapper around the button element that adds a variety of styles and functionality.

PropTypeDefault
variant"default" | "outline" | "ghost" | "destructive" | "secondary" | "link""default"
size"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg""default"

See the React Aria documentation for more information.

buttonVariants#

buttonVariants returns the classes for each variant (and size, for the button), so you can style a plain element such as a link the same way. It lives in its own file, button-variants.ts, which installs with button, and button.tsx re-exports it. The import path you already use is unchanged. Keeping it out of the component file means that file exports only components, which is what React Doctor's only-export-components rule checks.

import { buttonVariants } from "@/components/ui/button"
 
<a href="/pricing" className={buttonVariants({ variant: "outline", size: "sm" })}>
  Pricing
</a>
BubbleButton Group

On This Page

InstallationUsageCursorSizeDefaultOutlineSecondaryGhostDestructiveLinkIconWith IconRoundedSpinnerButton GroupAs LinkRTLAPI ReferenceButtonbuttonVariants