Components / Actions / Button
Button.
FreePrimitiveA Base UI-backed action control with semantic variants.
Demo dataResponsive
Installation
pnpm dlx shadcn@latest add https://elements.micropreneur.dev/r/button.jsonThe shadcn CLI writes the source into your project. Files added:
- components/ui/button.tsxui
- lib/utils.tslib
Dependencies@base-ui/reactclass-variance-authorityclsxtailwind-merge
API
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | 'default' | 'outline' | 'secondary' | 'ghost' | 'destructive' | 'link' | 'default' | |
| size | 'default' | 'sm' | 'lg' | 'icon' | 'default' |
Also accepts ButtonPrimitive.Props.
Accessibility
- Renders a native button through Base UI, so Enter, Space and disabled states work without extra code.
- Focus shows a ring plus a border change, not color alone.
- Icon-only buttons need an aria-label from the caller.