Components · Atoms

Button

Starts an action or moves to the next step. Four variants, one size, and a clear order of importance.

LevelAtom
Built fromA label, an optional icon
Used inForms, dialogs, banners, nav bar
CSS.cm-btn

When to use it

Use a button to

  • Submit a form or confirm a choice
  • Start something ("Book a walk")
  • Move to a next step or open a dialog

Don't use it to

  • Link inside a paragraph. Use a text link.
  • Pick one of many options. Use tabs, chips or radios.
  • Show status. Use a badge or tag.
Why

A screen should have one obvious next step. The four variants rank actions by importance so that step is clear at a glance, and so people don't have to read every label to know what to press.

Variants

Rule

One primary per view. If two actions compete, one of them is not primary. Use secondary for a supporting action next to a primary, quiet for a low-key action that still needs to be found, and ghost for the least important action, such as "Cancel".

States

Every variant reacts to the user. The hover and pressed rows are forced here so you can see them. Hover and press the real buttons on the first row to feel the motion.

Anatomy

Specs

Tokens by variant

Swatches show light then dark.

Contrast

Button labels must reach 4.5:1 against the button fill.

With an icon

A button can carry an icon from the icon set at icon-size-sm (16px). The arrow slides forward on hover to say "go". An icon before the label describes the action ("Download"). Don't use an icon alone in a text button. For icon-only controls use the icon button.

<a class="cm-btn cm-btn--primary" href="/book">
  <span class="cm-btn__label">Book a walk</span>
  <svg class="cm-btn__arrow" ...>...</svg>
</a>

Groups and layout

SituationPattern
Two actionsPrimary first, then secondary or ghost. gap: var(--space-4) between.
WidthHugs its content. Never stretch a button on desktop just to fill space. The label truncates with an ellipsis if it can't fit.
PhoneFull width (width: 100%) when it is the main action of a form or dialog, stacked with space-3 between. Keep the primary on top.
DialogsRight-aligned on web, primary last. On phones stack them full width, primary on top.

Web

Mobile

Light and dark

Playground



Writing the label

DoDon't
Start with a verb: "Book a walk", "Download CV", "Send message"."Click here", "Submit", "OK" or a bare noun like "Booking".
One to three words, sentence case.Long sentences, all capitals, or a capital on every word.
Say what happens: "Delete project" not "Yes".Ending with a period or exclamation mark.

Accessibility

Rules

RuleReason
One primary button per view.One clear next step.
Don't change size, radius or colors by hand. Use a variant.All buttons stay recognizable and keep their contrast.
Don't put two primary buttons side by side.Equal weight makes people hesitate.
Don't use color alone for meaning: a destructive action says "Delete" in its label.Color-blind users and screen readers.
Keep min-height, not a fixed height.The button grows with text zoom.
Do

One primary, a quieter secondary action.

<button class="cm-btn cm-btn--secondary">
  <span class="cm-btn__label">Cancel</span>
</button>
<button class="cm-btn cm-btn--primary">
  <span class="cm-btn__label">Save changes</span>
</button>
Don't

Two primary buttons side by side. Only one action can be the main one.

<button class="cm-btn cm-btn--primary">
  <span class="cm-btn__label">Cancel</span>
</button>
<button class="cm-btn cm-btn--primary">
  <span class="cm-btn__label">Save</span>
</button>

Code

<button class="cm-btn cm-btn--primary"><span class="cm-btn__label">Book a walk</span></button>
<button class="cm-btn cm-btn--secondary"><span class="cm-btn__label">See pricing</span></button>
<button class="cm-btn cm-btn--quiet"><span class="cm-btn__label">Learn more</span></button>
<button class="cm-btn cm-btn--ghost"><span class="cm-btn__label">Cancel</span></button>
<button class="cm-btn cm-btn--primary" disabled>...</button>