Actions
How buttons, links and menus are placed so every screen has one clear next step. Emphasis by variant, neutral for actions, coral only when something will be destroyed.
This guide decides which variant an action gets, where it goes, and when it turns coral. It applies to every button, link and menu row. The component itself is on Button.
Ask one question: does this destroy something?
| Answer | Variant | Why |
|---|---|---|
| Yes, and it's the main action (a confirm dialog) | destructive | The one place a coral fill is right |
| Yes, in a row, card or menu | ghost-destructive, link-destructive, or a destructive menu row | Coral, but quiet until it's needed |
| No, it's what people came to do | primary | The next step |
| No, it's an alternative to that | secondary | Visible, but steps back |
| No, it's in a toolbar, row or card | ghost | Present without competing |
| No, it sits in a sentence or goes somewhere | link | Reads as part of the text |
One primary per view
Each view has at most one primary button. If two actions compete, neither is primary: make one secondary, or ask which one most people came for.
<div className="flex justify-end gap-2">
<Button variant="secondary">Cancel</Button>
<Button>Save changes</Button>
</div>The primary goes last
In dialogs, forms and footers the primary action sits on the right, alternatives to its left, 8px apart (gap-2). People read to the end and find the next step there.
Labels say what happens
- Verb + noun, in sentence case: "Connect provider", "Rename agent".
- Name the result: "Create agent" tells people what they'll get; "Continue" doesn't.
- Not "Submit", "OK" or "Click here"; no all caps, no full stop.
Sizes match the fields beside them
sm 32px, md 36px (default), lg 40px. lg is the largest, also on mobile, where touch targets are at least 40px. xs (28px) is for dense chrome like toolbars. Inputs and selects share these sizes, so a button sits level with the field next to it.
Icon buttons always say what they do
<Tooltip>
<TooltipTrigger asChild>
<Button variant="ghost" square aria-label="Copy link"><Link2 /></Button>
</TooltipTrigger>
<TooltipContent>Copy link</TooltipContent>
</Tooltip>An icon-only button has an aria-label and a tooltip with the same words. Icons go straight inside Button; it sizes them.
Three actions show, more go in a menu
- Up to three related actions: buttons.
- More than three, or actions on each row or card: a
ghostsquare⋯ button opening a Dropdown menu withalign="end". - Menu rows are verb + noun, most used first, destructive rows last after a separator.
Permanent deletes are confirmed by name
| Situation | Do |
|---|---|
| Delete one thing, easy to undo | Delete right away, then offer undo |
| Delete something permanent or large | A dialog that names it: "Delete Research agent?", the consequence, and a destructive "Delete agent" button |
| Remove inline, e.g. disconnect | link-destructive |
Focus Cancel when a confirm dialog opens, never the destructive button.
Loading beats disabled
<Button loading> keeps the width, shows a spinner and blocks clicks while an action runs. Disable a button only when the action truly can't happen yet, and say why: helper text, or a tooltip on a wrapper (a disabled button can't show one). Often it's better to keep it enabled and explain what's missing when it's pressed.
Accessibility
Use <button> for actions and <a> for navigation (Button asChild keeps the look). Every action is reachable with Tab and shows the gold focus ring; don't remove it.
Not covered here
Submitting and validating forms is Forms. Why coral is reserved is Color usage.
Checklist
- At most one primary per view, placed last.
- Coral only on destructive actions.
- Every icon-only button has an
aria-labeland a tooltip. - No disabled button without a reason people can see.