Button
buttonThe primary action element. Four variants and three sizes, gradient primaries that crossfade on hover rather than snap, and an icon contract where the button owns the icon size. No client boundary, so it works in a server component and ships no JavaScript.
import { ArrowRight, Plus, Trash2 } from "lucide-react";
import { Button, ButtonLink } from "@/components/forme/button/button";
/**
* The showcase, in the order someone actually decides things: the four variants,
* then the three sizes, then icons.
*
* Kept to three rows on purpose. A demo that also documents every state stops
* being a preview of the component and becomes a page, and the row you would
* actually copy from gets lost in it. States live in the docs table instead.
*/
export function ButtonDemo() {
return (
<div className="flex flex-col gap-8">
<div className="flex flex-wrap items-center gap-3">
<Button>Get started</Button>
<Button variant="secondary" trailingIcon={ArrowRight}>
Continue
</Button>
<Button variant="ghost">Mark as done</Button>
<Button variant="danger">Delete</Button>
</div>
<div className="flex flex-wrap items-center gap-3">
<Button size="medium">Medium</Button>
<Button variant="secondary" size="small">
Small
</Button>
<Button variant="ghost" size="xs">
Xs
</Button>
</div>
<div className="flex flex-wrap items-center gap-3">
<Button leadingIcon={Plus}>New project</Button>
<Button variant="secondary" trailingIcon={ArrowRight}>
Continue
</Button>
<Button variant="danger" leadingIcon={Trash2}>
Delete
</Button>
<Button iconOnly leadingIcon={Plus} aria-label="New project" />
<Button variant="secondary" iconOnly leadingIcon={Plus} aria-label="New project" />
<Button variant="ghost" size="small" iconOnly leadingIcon={Plus} aria-label="New project" />
</div>
<div className="flex flex-wrap items-center gap-3">
<Button loading>Saving</Button>
<Button variant="secondary" loading>
Saving
</Button>
<Button disabled>Disabled</Button>
<Button variant="ghost" disabled>
Disabled
</Button>
<Button variant="danger" disabled>
Disabled
</Button>
</div>
<div className="flex flex-wrap items-center gap-3">
<ButtonLink href="/docs/introduction">Documentation</ButtonLink>
<ButtonLink href="/docs/cli" variant="secondary" trailingIcon={ArrowRight}>
Changelog
</ButtonLink>
</div>
</div>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
Usage
import { Plus } from "lucide-react";
import { Button } from "@/components/forme/button/button";
<Button leadingIcon={Plus}>New project</Button>
<Button variant="secondary">Cancel</Button>When to use
Reach for it
- Any action on the page: submitting a form, opening a dialog, starting a task.
ButtonLinkfor something that looks like a button but navigates.
Use something else
- Navigation inside running text — that is a link.
- Destructive actions that need a second step; reach for
ConfirmButtonorHoldButton.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
Button
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'primary' | 'secondary' | 'ghost' | 'danger' | "primary" | |
size | 'small' | 'medium' | 'xs' | "medium" | |
iconOnly | boolean | false | Square, icon-only. Requires an aria-label: the icon is decorative, so without a label the button has no accessible name at all. |
leadingIcon | ButtonIcon | — | |
trailingIcon | ButtonIcon | — | |
loading | boolean | false | Shows progress without losing the button. A loading button stays focusable and keeps its label in place, so the width does not jump mid-click and the keyboard focus does not disappear under the person using it. |
asChild | boolean | false | Render as the single child element instead of a <button>, keeping the styles and the keyboard behaviour. |
Also takes every prop of <button> attributes.
ButtonLink
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'primary' | 'secondary' | 'ghost' | 'danger' | "primary" | |
size | 'small' | 'medium' | 'xs' | "medium" | |
iconOnly | boolean | false | |
leadingIcon | ButtonIcon | — | |
trailingIcon | ButtonIcon | — |
Also takes every prop of <a> attributes.
Accessibility
- A native
<button>, so Enter, Space and the disabled state are the browser's own. - An
iconOnlybutton needs anaria-label: its icon is decorative and has no name of its own. - While
loadingit isaria-disabledandaria-busyrather than disabled, so it keeps focus and its width.
Motion
- None. Hover and press change colour on the frame they happen, and press is a darker step, never a scale.
Related


Hold Button
Press and hold to confirm, with a fill that sweeps across while you hold and drains back if you let go early. For actions too serious for one click and too small for a dialog. Space and Enter hold it from the keyboard.
buttons

Theme Toggle
A sun that sets into a crescent moon, and the new theme revealed from the button with a View Transition: a circle, a soft-edged spill or a shutter, measured to the farthest corner. No theme library, no flash, and a setTheme you can call from anywhere.
buttons

Image Generation
An image an assistant is making: the frame keeps the image's shape from the start, a field of dots ripples while it generates, the image sharpens in through refining, and a failure offers to try again.
data display