Button
A button component with multiple variants and sizes.
Import
import { Button } from "@retents/ui/button"Usage Guidelines
When to use
- To trigger an action such as submitting a form, opening a dialog, or performing a destructive operation.
- When you need to visually communicate the importance of an action using
variant(e.g.,defaultfor primary CTAs,secondaryfor less important actions,destructivefor danger). - As an icon-only action trigger using
size="icon"— for example, a close or add button.
When NOT to use
- For navigation to another page — use an anchor (
<a>) or your router's Link component instead. If you need link styling, usevariant="link"or therenderprop with an anchor. - As a toggle between two states — use Toggle or Switch instead.
- To display a status or label — use Badge instead.
Accessibility
Always provide visible text or an aria-label for icon-only buttons so screen readers can announce the action.
Preview
Variants
The Button component supports several visual variants:
- default — Primary action button with the brand orange color and subtle gradient overlay
- destructive — For dangerous or irreversible actions
- outline — Bordered variant with primary color tint
- secondary — Neutral button for secondary actions
- ghost — Minimal button with no background
- link — Styled as a text link with underline on hover
Sizes
Source
Render as another element
Use the render prop (Base UI) to render a different element (e.g., a link) with button styling. Pass nativeButton={false} when the rendered element is not a <button>:
<Button render={<a href="/docs" />} nativeButton={false}>
Go to docs
</Button>Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "default" | Visual style variant |
size | "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "default" | Button size |
render | ReactElement | function | — | Replace the rendered element (Base UI useRender) |