Button

Starts an action: save, send, delete. Four variants, two sizes, an icon only version, and a loading state that keeps its label. If it goes somewhere instead, it is a link.

Try it

Press it: it shows the loading state for a moment, keeps its label, and cannot be pressed twice.

Choices

Primary

The one main action in a view. Use one per screen or section.

Secondary

Other actions beside the primary one.

Ghost

Low emphasis, for toolbars and quiet choices.

Danger

Only for deleting or what cannot be undone. Say exactly what happens.

Link

If it goes somewhere, it is a link, even when it looks like a button.

Icon only

A 44 pixel square with a spoken name. Hover shows the name too.

Loading

The label stays and a ring turns. Screen readers hear loading.

Add a title before you publish.

Disabled

Still reachable by keyboard, with the reason beside it.

For how buttons answer hover, focus, and press, see the Interaction room.

Code

Plain HTML for any site, or React. Both use the same styles, so the button looks the same wherever it lands.

ReadyAny website, Shopify, WordPress, Square, plain hosting

<link rel="stylesheet" href="tokens.css">
<link rel="stylesheet" href="base.css">

<!-- Variants: prism-btn--primary, --secondary, --ghost, --danger. Large: add prism-btn--lg. -->
<button type="button" class="prism-btn prism-btn--primary">Save changes</button>
<button type="button" class="prism-btn prism-btn--secondary">Cancel</button>
<button type="button" class="prism-btn prism-btn--danger">Delete project</button>

<!-- A link that looks like a button: keep it an <a>, since it goes somewhere. -->
<a class="prism-btn prism-btn--secondary" href="/pricing">See pricing</a>

<!-- Icon only: a 44px square. aria-label is what screen readers say. -->
<button type="button" class="prism-btn prism-btn--ghost prism-btn--icon" aria-label="Close" title="Close">
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18" stroke-linecap="round"/></svg>
</button>

<!-- Loading: the label stays, a ring turns, and it cannot be pressed twice. -->
<button type="button" class="prism-btn prism-btn--primary" aria-busy="true" aria-disabled="true">
  <span class="prism-btn__spinner" aria-hidden="true"></span>Save changes<span class="prism-visually-hidden">, loading</span>
</button>

<!-- Disabled: aria-disabled keeps it reachable by keyboard. Say why next to it. -->
<button type="button" class="prism-btn prism-btn--primary" aria-disabled="true" aria-describedby="publish-why">Publish</button>
<p id="publish-why">Add a title before you publish.</p>

Accessibility