On this page

InstallationUsageAnatomySizesEmphasisColorHighLowGhostLinkIcon onlyWith an iconWith a status dotTooltipLoadingWhere the Loader goesDisabledGoes to a pageStatesIn a groupAccessibilityAPI ReferenceButtonRulesOpen questionsHierarchyPlacement and orderLabelsIconsDestructive actionsLoading and disabledGroupingLinks, size and widthWhat others expose

Button

Starts an action, or takes you somewhere: a color times an emphasis, in four sizes, with an icon before or after the label, or alone.

1<Button color="primary" emphasis="high" iconStart={Plus}>New agent</Button>2<Button>Cancel</Button>

Installation

import { Button } from "@catalog-developer/components";

Usage

import { Button } from "@catalog-developer/components";
<Button color="primary" emphasis="high">Save changes</Button>

Anatomy

1234
  1. 1 — Box. The fill and its edge. The edge is a shadow, never a border, so the button is as tall as it says. A ghost and a link have no box at rest.
  2. 2 — Start icon. Before the label.
  3. 3 — Label. A verb in the imperative (design/principles.md), in medium weight.
  4. 4 — End icon. After the label: what happens next.
SizeHeightTextIconIcon only
md32pxlabel-2, 13px14px32 by 32px
sm28pxlabel-2, 13px14px28 by 28px
xs24pxlabel-3, 12px12px24 by 24px
xxs20pxlabel-4, 11px10px20 by 20px

Sizes

Four sizes: md (the default), sm, xs and xxs. Inside a card's header or footer a button asked for at medium renders small.

1<Button size="md">Medium</Button>2<Button size="sm">Small</Button>3<Button size="xs">Extra small</Button>4<Button size="xxs">Tiny</Button>

Emphasis

How loud a button is: high the solid, low the soft one and the default, ghost no chrome until hover, link text only.

1<Button emphasis="high">High</Button>2<Button>Low</Button>3<Button emphasis="ghost">Ghost</Button>4<Button emphasis="link">Link</Button>

Color

The Badge's seven. Neutral is the default, so a plain <Button> is neutral and low.

1<Button>Neutral</Button>2<Button color="primary">Primary</Button>3<Button color="success">Success</Button>4<Button color="warning">Warning</Button>5<Button color="error">Error</Button>6<Button color="info">Info</Button>7<Button color="fuchsia">Fuchsia</Button>

High

The solid: the one action a view is for. Error high is the final "yes, delete", inside a confirmation.

1<Button emphasis="high">Cancel</Button>2<Button color="primary" emphasis="high">Save changes</Button>3<Button color="success" emphasis="high">Approve</Button>4<Button color="warning" emphasis="high">Review</Button>5<Button color="error" emphasis="high">Delete agent</Button>6<Button color="info" emphasis="high">Learn more</Button>7<Button color="fuchsia" emphasis="high">Try the preview</Button>

Low

Neutral low is the white, button-like default. A color's is its Badge's fill inside a faint ring; error low opens the confirmation.

1<Button>Cancel</Button>2<Button color="primary">Save changes</Button>3<Button color="success">Approve</Button>4<Button color="warning">Review</Button>5<Button color="error">Delete agent</Button>6<Button color="info">Learn more</Button>7<Button color="fuchsia">Try the preview</Button>

Ghost

No chrome until hover. A color's ghost has its link's label, and a tint of that color under the pointer; error ghost is a row's or a toolbar's labelled destructive action.

1<Button emphasis="ghost">Cancel</Button>2<Button color="primary" emphasis="ghost">Save changes</Button>3<Button color="success" emphasis="ghost">Approve</Button>4<Button color="warning" emphasis="ghost">Review</Button>5<Button color="error" emphasis="ghost">Delete agent</Button>6<Button color="info" emphasis="ghost">Learn more</Button>7<Button color="fuchsia" emphasis="ghost">Try the preview</Button>

Link

Text only. Primary is the brand-colored link, neutral the gray one; a color's link is its text color and gets stronger under the pointer.

1<Button emphasis="link">Cancel</Button>2<Button color="primary" emphasis="link">Save changes</Button>3<Button color="success" emphasis="link">Approve</Button>4<Button color="warning" emphasis="link">Review</Button>5<Button color="error" emphasis="link">Delete agent</Button>6<Button color="info" emphasis="link">Learn more</Button>7<Button color="fuchsia" emphasis="link">Try the preview</Button>

Icon only

An icon with no label makes a square button. It needs a name: its tooltip text becomes its aria-label unless one is given.

1<Button iconStart={Plus} tooltip="New agent" />

With an icon

iconStart goes before the label, iconEnd after it: what happens next, a menu opening or a page to go to. Beside a label the icon rests a step quieter and takes the label's color on hover, except on a link, where it matches the text.

1<Button color="primary" emphasis="high" iconStart={Plus}>New agent</Button>2<Button iconEnd={ChevronDownSmall}>Actions</Button>

With a status dot

dot puts a status dot in the start icon's place, for a button that shows a state. Its colors, sizes and halo are on the Status dot's page.

1<Button dot={{ color: "success" }}>Active</Button>

Tooltip

A string, or the tooltip's settings with its text (side, align, delay…). It shows at once, above the button and centered, unless told otherwise.

1<Button tooltip="Saves a draft you can come back to">Save draft</Button>

Loading

While its action runs, a button shows the Loader. It doesn't fire, keeps the focus and says it is busy (aria-busy). The Loader and what it replaces cross with the Icon swap: 250ms, each fading, blurring by 2px and scaling from a quarter of its size; at once under reduced motion. Nothing else moves. Press one: it loads for two seconds.

1<Button color="primary" emphasis="high" iconStart={Plus} loading={saving} onClick={save}>New agent</Button>2<Button loading={saving} onClick={save}>Save draft</Button>3<Button iconStart={Plus} tooltip="New agent" loading={saving} onClick={save} />

Where the Loader goes

loadingPlacement says where; a button takes two placements, by whether it has an icon (a status dot counts). With an icon: icon, the default, in the icon's place, left or right, or replace, in place of everything. With none: replace, the default, in place of the label, or before, before it; there is no “after”. Only before changes the width, by the Loader and its gap (21px at md, 19 at sm, 16 at xs, 14 at xxs); otherwise the button's width and the label's place hold to the pixel.

1// With an icon: in its place (the default), or in place of everything2<Button iconStart={Plus} loading>New agent</Button>3<Button iconEnd={ChevronDownSmall} loading>Actions</Button>4<Button iconStart={Plus} loading loadingPlacement="replace">New agent</Button>5 6// With no icon: in place of the label (the default), or before it7<Button loading>Save draft</Button>8<Button loading loadingPlacement="before">Saving</Button>9 10// Incorrect: "before" is not offered next to an icon. This does not compile.11<Button iconStart={Plus} loading loadingPlacement="before">Saving</Button>

Disabled

1<Button color="primary" emphasis="high" disabled>Save changes</Button>

Goes to a page

A button that goes to a page looks like any button and is the app's link underneath (render, with nativeButton={false}); beside it, emphasis="link" is the opposite: it looks like a link and is a button.

All agents
1<Button iconEnd={ArrowRight} nativeButton={false} render={<Link href="/agents" />}>2  All agents3</Button>4<Button color="primary" emphasis="link" onClick={showDetails}>Show details</Button>

States

What a button does by itself in each state. None of it is a prop.

HoverA color's low goes to a stronger stop, neutral low lays the hover tint over its fill (twice as strong in dark), a neutral ghost takes the gray hover fill and a color's a tint of its color, and a link changes its text color only. A solid's hover is its gradient one stop darker: primary's and error's are placeholders, and the tokens mark them "to define".
PressedThe button shrinks to 97% while it is held. Not a button that opens a popup (the open popup is anchored to it), not a disabled or loading one, not a group's item, and not under reduced motion.
FocusA 3px ring, the focus color at 50%, only when the keyboard lands on it.
OpenWhile its menu or popover is open, a ghost button keeps its hover fill.
DisabledHalf opacity, no pointer, out of the Tab order. With focusableWhenDisabled it stays in the Tab order and does not fire, but it does not fade either: it looks enabled.

In a group

Buttons that act on one thing can be joined into one control: a ButtonGroup of ButtonGroupItems. An item's props differ from a Button's in two ways: its look and size come from the group, and it can carry a badge. The group has its own page.

1<ButtonGroup size="sm" aria-label="Key">2  <ButtonGroupItem iconStart={Copy}>Copy</ButtonGroupItem>3  <ButtonGroupItem iconStart={Edit}>Rename</ButtonGroupItem>4  <ButtonGroupItem iconEnd={ChevronDownSmall}>More</ButtonGroupItem>5</ButtonGroup>

Accessibility

A Button is a real <button>: the Tab key reaches it, Enter and Space press it, and it draws a ring when the keyboard lands on it. It does not submit a form unless you say type="submit". Under reduced motion it does not shrink when pressed and changes color at once.

A button with no label needs a name. A tooltip given as a string is that name, so most icon buttons need nothing more. A tooltip given as elements names nothing, and neither does no tooltip: add an aria-label. Nothing stops an unnamed icon button from being built.

Four things are not settled, and are open questions below: how small a target can be, whether a disabled button stays focusable, whether loading is announced, and what a link drawn as a button is called.

API Reference

Button

Besides these, every prop of Base UI's Button (disabled, type, onClick, className…).

PropTypeDefaultDescription
color"neutral" | "primary" | "success" | "warning" | "error" | "info" | "fuchsia""neutral"The Badge's seven colors. Every color has every emphasis.
emphasis"high" | "low" | "ghost" | "link""low"How loud it is: the solid, the soft one, no chrome until hover, or text only. Rules say which goes where.
size"md" | "sm" | "xs" | "xxs""md"The control size. A surrounding size cap (a card's header or footer) lowers it; a smaller size passes through.
shape"default" | "round""default"Its corners: its size's own, or fully round (a circle when it is an icon alone, a pill with a label).
iconStartIconComponent—An icon before the label. Alone, with no label, the button is a square and needs a name: aria-label, or tooltip text.
iconEndIconComponent—An icon after the label: what happens next (a menu opens, you go somewhere).
dot{ color?, size?, halo?, haloSize?, pulse? }—A Status dot in the start icon's place, in the icon's box: color is one of the Badge's, size is sm, md, lg or xl (4, 6, 8, 10px; left out, the icon's box gives it), halo is "none" or "tint", haloSize is sm, md, lg or xl (2, 3, 4, 6px; left out, the largest that fits in the icon's box), pulse is for something live. With a dot, iconStart is not drawn.
tooltipstring | ButtonTooltip—Shown on hover and focus: the text, or the text with the tooltip's settings (side, align, delay…). On a button with no label, the text also becomes its aria-label unless one is given.
loadingbooleanfalseIts action is running: the Loader shows where loadingPlacement says. The button doesn't fire, keeps the focus and sets aria-busy.
loadingPlacement"icon" | "replace" | "before""icon" with an icon, "replace" with noneWhere the Loader goes. With an icon or a dot: icon, in the icon's place (the first icon's when there are two), or replace, in place of everything. With none: replace, in place of the label, or before, before it, and the button grows. The type follows the icons: before next to an icon, or icon with none, does not compile.
childrenReactNode—The label.
renderReactElement—Base UI's: render the button as another element, a link for instance. Pair it with nativeButton={false}.

Rules

Open questions

Icons on buttons: often, or rarely?

Open
Ours

Pair an icon with a label whenever practical.

Other systems

Leave icons off most buttons; add one only when its meaning is well established and it shows the action itself. (Atlassian, Carbon, Material 3, Apple.)

Where do a page's buttons sit?

Open
Ours

In a page header the actions sit on the right, the primary last.

Other systems

On full-page forms, content-heavy pages and cards, align buttons left, the primary first. (Atlassian, Carbon; Primer always ends a group with the primary.)

A status dot on a button

Open
Ours

Built as the dot prop. Not confirmed: the dot's size in a 32 or 28px button's 14px icon box (6px as built; 8px is the other size that centers on whole pixels).

Other systems

Not compared with other systems yet.

How small can a button be?

Open
Ours

The xxs button is 20px tall.

Other systems

Every clickable target is at least 24 × 24px, the smallest icon buttons included. (Primer; Apple asks for 44pt, Material 3 for 48dp on icon buttons.)

A link that looks like a button: what does a screen reader hear?

Open
Ours

A button. The example above (render with nativeButton off) is how the dashboard does it, in dozens of places: the element is a link, and Base UI gives it the role of a button. Nothing written chooses.

Other systems

Base UI, which ours is built on, says its Button should not be used for links. shadcn puts the button's look on a plain link, and its page says not to render its Button as a link, which is what our example does. Primer and Polaris give a button a real link form that stays a link. Atlassian, Carbon and Polaris: buttons act, links navigate.

Should a screen reader be told when loading starts and ends?

Open
Ours

It is not today: the button says it is busy if you land on it, and nothing is announced when the work starts or finishes. Nothing written chooses.

Other systems

Primer announces it in a polite live region and lets you write the words. Base UI suggests tying the button to the changing text.

Is there a pressed look for a button that toggles?

Open
Ours

There is none: a button that is on (aria-pressed) looks the same as off. For a value changed in place the README names another component: "A toggle group changes a value in place: a filter, a view, a unit. Dome uses Tabs for both today." Nothing written says whether a Button may toggle.

Other systems

Polaris has a pressed state and Atlassian a selected one.

Does a disabled button stay focusable?

Open
Ours

The written principle and the component disagree. design/principles.md: disabled items "stay in the DOM and remain focusable so screen-reader users know they exist", at 40% opacity. The ds Button's disabled takes it out of the Tab order, at 50%. focusableWhenDisabled keeps it in and stops it firing, but that button does not fade: it looks enabled.

Other systems

Atlassian and Primer prefer an enabled button with a message to a disabled one. Primer also has an inactive button: it looks unavailable, stays focusable and says why when pressed. Ours has no such state.

Hierarchy

One primary action per view

Primary is the main action of a view, and the default of the dashboard's own Button (components/ui/button.tsx); the ds Button's default is neutral low. One per view, last on the right.

Give each view, dialog or panel no more than one primary button, and make every other action less prominent.

From Atlassian, Carbon, Primer, Polaris and Material 3. Apple allows one or two prominent buttons; Carbon a second primary only while a modal or side panel with its own is open.

A view doesn't need a primary

On a page that's mostly for reading or working with data, use only neutral low and quieter buttons.

From Carbon.

Neutral low for every other action

Every other action, and the default when no color or emphasis is given; Cancel and Close beside a submit.

Use the default button for most actions; pick a stronger or quieter style only when an action needs more or less weight.

From Primer, Polaris and Atlassian, for the second paragraph.

Ghost where boxes would crowd

No chrome until hover: a quiet action where boxes would crowd, like a toolbar or a row.

Where many actions sit together (toolbars, table toolbars, cards), use quiet styles, and only where it's clear they're clickable.

From Carbon, for the second paragraph.

The primary lives in the header or the content, not both

When the content or a table toolbar owns the main action, the page header's buttons drop a level.

From Carbon.

Placement and order

Save changes to this agent?

A dialog ends with its primary

In a dialog, sheet or panel, submit sits in the footer, right-aligned, with Cancel or Close to its left.

In dialogs, wizards and other focused tasks, the buttons align to the trailing edge, the primary furthest right.

From design/principles.md, for the first paragraph; Atlassian, Carbon, Material 3, Apple and Primer, for the second.

Stacked, the primary goes on top

When buttons stack, the primary goes on top and Cancel at the bottom.

From Carbon and Material 3.

Publish this bundle?

The primary is the default action

It takes the first focus in a dialog, and Enter triggers it. A destructive button is never the default.

From Carbon and Apple.

Same place, same order

Keep each action in the same place across screens, and the buttons in the same order at every width, so the tab and screen-reader order never change.

From Polaris and Material 3.

API keys

Cards hold small buttons

A card's header and footer hold small buttons: a button asked for at medium renders small there, because medium is for the page header.

Keep a dialog's or a popover's content outside a card's header or footer, its trigger inside. Don't put Cancel and Save on a card: that pair lives in dialogs.

From ds/lib/size-cap.tsx and ds/README.md (Card), for all but the last sentence.

Labels

Labels are verbs

A label is a verb in the imperative: “Register agent”, “Rollback bundle”, “Revoke key”.

Name the object as well as the verb, never a noun on its own. Short, universal actions (Done, Close, Cancel, Add, Delete) can stand alone.

From design/principles.md, for the first paragraph; Carbon, Polaris and Atlassian, for the second; Apple asks for the verb first.

Sentence case

Write labels in sentence case.

From design/principles.md, Atlassian, Carbon, Material 3, Polaris and Primer; Apple uses title case.

Short labels

Keep labels short, with no articles and no ending punctuation.

From Atlassian (short, no punctuation), Polaris (no unnecessary words or articles), Apple (a few words) and Material 3.

Rotate this key?

Name the result

Make the label name the specific result, in the words of the heading or dialog title it acts on.

From Atlassian.

Name the action, not Yes or No

Don't confirm an action with Yes or No: name the action.

From Atlassian. For OK they differ: Polaris's earlier content guide allows it, and Material 3 uses it in date and time pickers.

One line

Keep a label on one line; shorten the words rather than let them truncate.

From Material 3 and Primer. Carbon wraps a long label instead; Atlassian truncates as a last resort.

A picker shows its value

A button that opens a picker shows the current value, and “3 selected” when several are chosen, never a comma-separated list.

From Primer.

Icons

The icon first, the chevron last

iconEnd says what happens next: a menu opens, or you go somewhere.

An action's icon goes before the label; the end is for what happens next, a dropdown chevron for instance.

From Material 3 and Primer, for the second paragraph. Atlassian allows either side; Carbon puts icons after the label.

Icon-only when the icon is obvious

Icon-only is for compact toolbars where the label is obvious in context, like the collapsed sidebar or a table row's actions, and it needs a name: its tooltip text. Don't use an icon-only button where the label isn't obvious from what's around it.

Use our set's icons, for common actions everyone recognizes; where no icon is obvious, use a text label.

From design/principles.md, for the first paragraph; Atlassian, Carbon, Material 3, Primer and Polaris, for the second.

Name the action, not the icon

An icon-only button's name says what it does, not what it shows, and appears as a tooltip on hover and on keyboard focus. A name that adds to a visible label contains that label word for word, so voice control finds it.

From Atlassian, Primer, Material 3, Carbon and Polaris; Apple names hover tooltips only.

An icon beside text is tamed

An icon beside text is tamed: a step softer than the text. Links are the exception: their icon matches the text. An icon-only button is not tamed: the icon carries the full text ink.

From ds/components/button.tsx.

Destructive actions

Red only to destroy

Error low is the soft red: a destructive action that opens a confirmation, or acts in place. Error high is the solid red: only the irreversible action inside a confirmation, the final “yes, delete”.

Open a confirmation with error low, and confirm in it with error high. Don't use the solid red (error high) outside a confirmation.

From ds/README.md (Button): the soft red opens the confirm, the solid red is the final yes.

Delete this key?

Confirm with the verb and the object

Confirm an irreversible action in a dialog whose red button repeats the verb and the object, “Delete key”, beside a plain Cancel.

From Polaris, Primer, Atlassian and Apple. Apple skips the confirmation for deletes that can be undone.

Red is never the only signal

Red is never the only sign that an action destroys: the label says it too.

From Primer. Carbon allows an icon-only danger button.

Loading and disabled

Explain rather than disable

Prefer an enabled button and a validation message to a disabled one: a disabled button doesn't say why. Never put a tooltip on a disabled button. Whether a disabled button stays focusable is an open question above.

From Atlassian and Primer. Material 3 disables a dialog's confirm until a choice is made.

Progress inside the button

While its action runs, show progress inside the button and block repeat submits; keep it focusable, and move focus to the error if it fails. Whether the progress is announced is an open question above.

From Apple, Atlassian, Carbon, Polaris and Primer; they differ on whether the spinner replaces the label.

A changing label keeps its length

When a label changes with state (Save to Saved), keep the two close in length so the button doesn't jump.

From Material 3 and Primer.

Grouping

Group by object; past three, a menu

Group only buttons that act on the same object; past two or three related actions, move the rest into a menu.

From Carbon, Atlassian, Polaris and Material 3.

One size and one family in a group

Keep one size and one style family within a group, and mark the preferred option by style, not size.

From Apple and Carbon; Material 3 makes the main action larger.

No split button: a group that ends in a chevron

What a split button was for is a button group whose last item is icon-only, the small chevron, as a Dropdown menu's trigger. There is no primary group.

From ds/README.md (Button group).

Links, size and width

View agent

Links are text, with no box

The primary link is the brand-colored one; the dashboard's link button. The neutral link is the gray one: a link that should not compete with the content around it.

As tall as what's beside it

Make a button as tall as the inputs beside it: medium by default, small in tables and toolbars.

In a page header every control is 32px, and shrinks to 28px as the header collapses.

From Carbon and Primer, for the first paragraph; design/principles.md, for the second.

Sign in

Full width only in narrow places

Use a full-width button only in a narrow container (a side panel, a sign-in form, a small card); everywhere else a button fits its label.

From Polaris and Material 3. Carbon says the opposite: it prefers fluid-width buttons to fixed-width ones.

What others expose

What shadcn, Atlassian, Polaris and Primer offer for buttons, and where ours stands on each. What the open questions above already cover (a real link, loading announced, a pressed state, an unavailable button that says why) is not repeated here.

They exposeOursWhy
A full-width button (Primer, Polaris, Atlassian)Already thereA width class, w-full.
A mark that the button opens more (Polaris, Primer)Already thereiconEnd with the small chevron.
A square icon button, by a size name (shadcn)Already thereA button with no label is a square by itself.
A button joined to a menu (Polaris, Atlassian)Already thereA ButtonGroup whose last item is an icon-only chevron, as a Dropdown menu's trigger.
Labels for what a button opens (Polaris)Already thereThe aria attributes pass through, and a menu's trigger sets them.
A name required on an icon button (Atlassian)AskOurs compiles with neither a tooltip nor a label.
A key shown on the button (Primer, shadcn)AskOur Kbd has no colors for a solid fill.
A larger size (shadcn, Polaris, Primer)AskThe scale stops at md, 32px (ds/lib/chrome.ts).
A count inside the button (Primer)AskA Button takes no badge; a button group's item does (ds/README.md).
A label that wraps or aligns to the start (Primer); text alignment (Polaris)AskA label never wraps and is centered.
Other colors: success (Polaris); warning and discovery (Atlassian)AskOurs has the brand color and two reds.
Catalog
Foundations
  • Overview
  • Components
  • Tokens
  • Token usage
  • Typography
  • Icons
Atoms
  • Avatar
  • Badge
  • Button
  • Checkbox
  • Color picker
  • Copy button
  • Icon tooltip
  • Inline code
  • Input
  • Hint
  • Kbd
  • Loader
  • Native select
  • Progress bar
  • Progress ring
  • Radio
  • Select
  • Status dot
  • Switch
  • Text link
  • Textarea
  • Tooltip
  • Truncate
Molecules
  • Accordion
  • Activity chart
  • AI elements
  • Alert
  • Button group
  • Card
  • Code block
  • Combobox trigger
  • Command
  • Content table
  • Context switcher
  • Dropdown menu
  • Empty state
  • Field
  • Field group
  • Filter chip
  • Flow
  • Heading
  • Icon picker
  • Icon flow card
  • Metric card
  • Modal
  • Modal confirmation
  • Pagination
  • Popover
  • Scroll area
  • Sidebar
  • Table
  • Tabs
  • Toggle group
LibraryPublished release