Button
A neutral UI SDK action with native form behavior, pending feedback, and composable rendering.
Installation
npx shadcn@latest add @navui/buttonUsage
Use variant to set the visual emphasis of an action. Set type="submit" to submit a form, or return a Promise from onClick to show pending feedback.
import { Button } from '@/components/navui/button'
export function Example() {
return <Button>Save changes</Button>
}Examples
Action hierarchy
Give publishing and deleting their own action groups.
Publish article
Discard draft
Sizes
24px · xs
28px · sm
32px · default
40px · lg
Icons
Use a leading icon for a familiar action. Give icon-only buttons an accessible name with aria-label.
Reports
Rounded
Use rounded-full to give a specific action a pill shape.
Disabled
Explain why an action is unavailable near the button.
Enter an email address to enable invitations.
Pending action
Return a Promise from onClick. UI SDK keeps focus on the button and ignores repeat presses while the save runs.
Save and retry
The first save simulates a connection error. Select Save changes again to retry.
Form actions
This example uses NavUI Field and Input alongside native submit and reset actions.
Button as a link
Pass an anchor to render for native link behavior. A trailing arrow signals navigation.
API reference
Foundation component styled on UI SDK Button. See the UI SDK Button documentation for the complete inherited API.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "secondary" | "outline" | "ghost" | "destructive" | "link" | "default" | Semantic appearance. |
size | "xs" | "sm" | "default" | "lg" | "icon-xs" | "icon-sm" | "icon" | "icon-lg" | "default" | Text buttons and square icon buttons use 24, 28, 32, or 40 pixels. The minimum target is 44 pixels on touch-first devices. |