Components · Atoms
Button
Starts an action or moves to the next step. Four variants, one size, and a clear order of importance.
.cm-btnWhen 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.
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
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
| Situation | Pattern |
|---|---|
| Two actions | Primary first, then secondary or ghost. gap: var(--space-4) between. |
| Width | Hugs its content. Never stretch a button on desktop just to fill space. The label truncates with an ellipsis if it can't fit. |
| Phone | Full width (width: 100%) when it is the main action of a form or dialog, stacked with space-3 between. Keep the primary on top. |
| Dialogs | Right-aligned on web, primary last. On phones stack them full width, primary on top. |
Web
Mobile
Light and dark
Playground
Writing the label
| Do | Don'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
- Right element:
<button>for actions,<a href>for navigation. Both take the same classes. - Keyboard: reachable with Tab, activated with Enter and Space. The focus ring (2px, offset 2px) shows on every variant.
- Target size: at least 44px tall, even for quiet and ghost buttons that have no visible box.
- Contrast: white labels pass 4.5:1 on the primary and secondary fills in both themes (table above).
- Disabled: prefer to keep the button enabled and explain why on submit. If you disable, use
disabledon a button oraria-disabled="true"on a link. Disabled text is exempt from contrast, so never put essential information only in a disabled button. - Reduced motion: the lift, scale and shine are removed; only a color change remains.
Rules
| Rule | Reason |
|---|---|
| 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. |
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>
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>