Button
A button with gradient variants built on Base UI
Loading...
Installation
bunx @prototyperco/cli add buttonpnpm dlx shadcn@latest add https://prototyper-ui.com/r/button.jsonnpx shadcn@latest add https://prototyper-ui.com/r/button.jsonyarn dlx shadcn@latest add https://prototyper-ui.com/r/button.jsonbunx --bun shadcn@latest add https://prototyper-ui.com/r/button.jsonThis will add the following files to your project:
components/ui/button.tsx
Usage
import { Button } from "@/components/ui/button";
<Button>Click me</Button>;Examples
Destructive
Loading...
Outline
Loading...
Secondary
Loading...
Ghost
Loading...
Primary Soft
Loading...
Destructive Soft
Loading...
Success
Loading...
Warning
Loading...
Link
Loading...
Icon
Loading...
With Icon
Loading...
Loading
Loading...
Press
Loading...
Styling
Data Slots
Use data-slot attributes to target the button in CSS:
| Slot name | Element |
|---|---|
button | The <button> root |
Customization Examples
/* Make all buttons pill-shaped */
[data-slot="button"] {
@apply rounded-full;
}{
/* Use className for one-off overrides */
}
<Button className="rounded-full px-8">Pill Button</Button>;API Reference
Button
A clickable button element with gradient variants.
Prop
Type
All Base UI Button props are forwarded via ...props.
buttonVariants
A cva helper exported for use outside of the <Button> component (e.g., applying button styles to links).
import { buttonVariants } from "@/components/ui/button";
<a className={buttonVariants({ variant: "outline" })}>Link styled as button</a>;Accessibility
Keyboard Interactions
| Key | Action |
|---|---|
Space | Activates the button |
Enter | Activates the button |
Tab | Moves focus to / away from the button |
ARIA Attributes
- Renders as a native
<button>element by default via Base UI. aria-disabled="true"is set whenisPendingistrue.data-pendingattribute is set during the pending state for styling.
Compose
This component is available in @prototyperco/compose.