Button
Allows users to trigger actions, submit forms, or navigate with a single click, providing clear visual feedback and hover effects.
Installation
pnpm dlx shadcn@latest add @spaceui/primitives-buttonUsage
import { Button } from '@/components/ui/button'<Button>Button</Button>Link
You can use the render prop to render another element (like Next.js Link or React Router) with button styles.
import Link from 'next/link'
import { Button } from '@/components/ui/button'
export function LinkAsButton() {
return <Button render={<Link href="/login" />}>Login</Button>
}Features
Variants
Sizes
Standard sizing options: xs, sm, default, lg, xl.
Icon Sizes
Square button sizes designed specifically for single icons: icon-xs, icon-sm, icon, icon-lg, icon-xl.
Loading State
Support for native loading spinners via the loading prop.
Disabled
Button rendered in a disabled state via the disabled prop.
With Icon
Link as Button
API Reference
Button Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | default|destructive|destructive-outline|ghost|link|outline|secondary | default | Controls the button visual style |
size | default|icon|icon-lg|icon-sm|icon-xl|icon-xs|lg|sm|xl|xs | default | Controls the button size |
loading | boolean | false | Shows a spinner and disables the button while loading |
disabled | boolean | false | Disables pointer interactions and dims appearance |
render | React.ReactElement | - | Polymorphic render prop (e.g. Next.js Link) |
When loading is true, the component:
- Renders a spinner (
data-slot="button-loading-indicator") - Adds
data-loadingon the button root - Disables interaction and sets
aria-disabled="true" - Preserves button layout without jumping
Examples
Related Components
A button with a hover-reactive radial aurora gradient, an animated conic-gradient border, and a rotating shine sweep — powered by animatable CSS custom properties.
ViewTactile squircle button and badge components featuring dynamic curvature morphing on hover from the original portfolio design.
ViewA glassmorphic button built on top of Button Squircle — backdrop blur, layered inset highlights and a hover shine sweep.
View