Button
Use Button for actions such as saving, opening a dialog, or changing state. Use a link for navigation to another page.
Preview
Variants and sizes
Compare primary, soft, ghost, and destructive actions alongside small, large, icon, and disabled buttons.
Installation
New to this Registry? Complete the base setup before continuing.
npx shadcn@latest add @neumorphism-ui/buttonInstall the shared base once, then add components and their dependencies with the CLI.
Usage
Start with a text label, then choose variant for emphasis and size for dimensions. Set type explicitly inside forms and give icon-only buttons an accessible name.
"use client";
import { useState } from "react";
import { Button } from "@/components/ui/button";
export default function Example() {
const [saved, setSaved] = useState(false);
return (
<div>
<Button variant="primary" onClick={() => setSaved(true)}>Save changes</Button>
<p role="status">{saved ? "Changes saved." : "Unsaved changes."}</p>
</div>
);
}API Reference
Uses a native button to preserve form behavior and keyboard interaction. Provides five variants and four sizes, with an inset shadow representing the pressed state.
| Component | Prop | Type | Default | Description |
|---|---|---|---|---|
Button | variant | "default" | "primary" | "soft" | "ghost" | "destructive" | "default" | Selects the button meaning and degree of surface emphasis. |
Button | size | "sm" | "default" | "lg" | "icon" | "default" | Selects the height and horizontal padding. |
Button | type | "button" | "submit" | "reset" | "button" | Determines the native button behavior. |
Button | disabled | boolean | false | Disables pointer and keyboard interaction. |
Accessibility
- 01
Because it uses a native button, Space and Enter behavior and disabled semantics are preserved.
- 02
Always provide an aria-label that describes the action of an icon-size button.
- 03
For navigation, use a semantic anchor or Link instead of a Button click handler.