☀️ Summer Sale: up to 40% off all templates for a limited time.Get the deal
Shadcnadmin.com

Search

Search dashboards, components and blocks

Shadcn Button Components

Displays a button or a component that looks like a button. Every button example is built to work with both Radix UI and Base UI. Built with Shadcn UI, Tailwind CSS, Next.js and React, compatible with both Radix UI and Base UI primitives. Typescript included.

Button 1

Button 2

Button 3

Button 4

Button 5

Button 6

Button 7

Button 8

Button 9

Button 10

Button 11

Button 12

Button 13

Button 14

Button 15

Button 16

Button 17

Button 18

Button 19

Button 20

Button 21

Button 22

Button 23

Button 24

Button 25

Button 26

Button 27

Shadcn Button: 27 Ready to Use React Button Examples

Buttons carry almost every action in an interface, and the shadcn button gives you a consistent, accessible base with variant and size props styled through Tailwind CSS. This react button component ships as source code, so hover states, focus rings, and radii follow your design tokens instead of a vendor's.

This page gathers 27 copy-paste button examples for Next.js and Vite projects: solid, outline, ghost, and destructive treatments, icon buttons, loading states, buttons with badges and keyboard shortcut hints, split arrangements, and social sign-in styles, all typed in TypeScript.

Why use the Shadcn Button?

  • Variant driven styling: Default, secondary, outline, ghost, destructive, and link variants cover most product needs through a single prop instead of ad hoc class strings.
  • Sizes that compose: Small, default, large, and icon sizes keep buttons aligned across toolbars, forms, and dialogs.
  • asChild flexibility: The asChild prop lets a Next.js Link or any other element inherit full button styling, keeping semantics correct for navigation.
  • Consistent focus states: Every example keeps a visible focus ring, so keyboard users never lose their place.
  • 27 starting points: From plain labels to icon, loading, and grouped arrangements, you rarely need to design a button from scratch.

Production tips

  • One primary per view: Reserve the solid default variant for the single most important action and support it with outline or ghost buttons.
  • Disable during async work: Swap the label for a spinner and disable the button while a request is in flight to prevent double submits.
  • Label icon-only buttons: Icon buttons need an aria-label and usually a tooltip, since the icon alone is ambiguous to many users.
  • Use destructive sparingly: Red buttons lose meaning when overused. Pair truly dangerous actions with a confirmation dialog instead of relying on color alone.
  • Do not fake buttons with divs: A real button element gives you Enter and Space activation, form submission, and focus behavior for free.

Works well with other components

Buttons rarely appear alone. Related actions line up in a button group, overflow actions collapse into a dropdown menu, and destructive actions should confirm through an alert dialog. Icon-only triggers become self-explanatory with a tooltip, and async actions read clearly when the label yields to a spinner.

Every screen in our dashboard blocks leans on these same button patterns, from table toolbars to modal footers, so the examples here transfer directly.

Under the hood

The button needs no headless primitive. It is a plain HTML button element styled with Tailwind CSS, with variants managed through class-variance-authority as documented in the shadcn button docs. Native semantics already provide keyboard activation and form participation, so there is nothing to polyfill.

That simplicity means every example works unchanged in projects built on Radix UI or Base UI. The button has no primitive dependency to swap, only markup and classes you own.

FAQs

How do I make a Next.js Link look like a shadcn button?
Pass asChild to the Button and place the Link inside it. The anchor then receives all button styling while keeping correct link semantics and prefetching.
How do I show a loading state on a button?
Disable the button and render a small spinner beside or in place of the label while the request runs. Several examples on this page include this pattern ready to copy.
Does the shadcn button depend on Radix UI or Base UI?
No. It is a native button element styled with Tailwind CSS and class-variance-authority, so it works identically in Radix-based and Base UI-based projects without any primitive dependency.
Can I add my own button variant?
Yes. Because the component lives in your codebase, you add a new entry to the variants object in the cva definition, for example a brand or success variant, and it becomes available through the variant prop.
What size should touch targets be?
Aim for at least 44 by 44 pixels on touch devices. The default and large sizes meet this comfortably, while the small size is best kept for dense desktop toolbars.