Component guideEditable source

Button

Action buttons with explicit variants, sizes, and accessible interaction states.

Original component docs
On this page5 sectionsBack to top

Use Button for actions such as saving, opening a dialog, or changing state. For navigation, use an anchor or router link styled with buttonVariants; do not put a link inside a button.

Live preview
Loading preview...

#Installation

Complete the base setup. The CLI installs both files. For manual installation:

npx shadcn@latest add https://neobrutal-ui.andongmin.com/r/button.json

#Usage

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

export default function Example() {
  return <Button>Save changes</Button>;
}

Start with the normal button above. Use variant to change the appearance and size to change the dimensions. Use neutral for a raised action on a neutral surface. Keyboard focus uses the shared --ring token. The live preview shows the available styles, icon buttons, disabled states, and loading examples.

#API reference

Prop / partPurposeDefault
variantdefault, outline, ghost, destructive, link, noShadow, neutral, reversedefault
sizexs, sm, default, lg, icon, icon-xs, icon-sm, icon-lgdefault
typebutton, submit, or resetBase UI default
disabledPrevents interactionfalse
renderUses another button element while preserving behaviorNative button
aria-busyAnnounces pending work; it does not disable the controlUnset

#Accessibility

Give every icon-only button an accessible name with aria-label. Set type="submit" explicitly for form submission. Enter and Space activate the button. Manage pending state in your application and disable repeated submissions when appropriate. A custom element supplied to render must forward its props and ref to the underlying button.

The link variant changes appearance only. For a destination, import buttonVariants and apply it to an anchor or router link:

import { buttonVariants } from "@/components/ui/button-variants";

<a href="/docs" className={buttonVariants({ variant: "outline" })}>
  Read the guide
</a>;