Skip to content
Halorav0.1.0

Components

Button

Pill buttons with one primary look: deep orange with white content.

Variants#

Link as button
HTML
<button class="ha-button ha-button--primary" type="button">Primary</button>
<button class="ha-button ha-button--secondary" type="button">Secondary</button>
<button class="ha-button ha-button--ghost" type="button">Ghost</button>
<a class="ha-button ha-button--primary" href="#">Link as button</a>

Use <a> for navigation and <button> for actions.

Sizes#

HTML
<button class="ha-button ha-button--primary ha-button--sm" type="button">Small</button>
<button class="ha-button ha-button--primary" type="button">Medium</button>
<button class="ha-button ha-button--primary ha-button--lg" type="button">Large</button>

Medium is 48px tall, small is 40px, and large is 56px. Under 640px small buttons grow to 44px to meet the phone touch target.

With an icon#

HTML
<button class="ha-button ha-button--primary" type="button">Get started <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button>
<button class="ha-button ha-button--secondary" type="button"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false"><path d="M12 .5a11.5 11.5 0 0 0-3.6 22.4c.6.1.8-.3.8-.6v-2c-3.2.7-3.9-1.4-3.9-1.4-.5-1.3-1.3-1.7-1.3-1.7-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.4 1 .1-.8.4-1.3.7-1.6-2.6-.3-5.3-1.3-5.3-5.7 0-1.3.5-2.3 1.2-3.1-.1-.3-.5-1.5.1-3.1 0 0 1-.3 3.2 1.2a11 11 0 0 1 5.8 0c2.2-1.5 3.2-1.2 3.2-1.2.6 1.6.2 2.8.1 3.1.8.8 1.2 1.8 1.2 3.1 0 4.4-2.7 5.4-5.3 5.7.4.4.8 1.1.8 2.200v3.200c0 .3.2.7.8.6A11.5 11.5 0 0 0 12 .5z"/></svg> GitHub</button>
<button class="ha-button ha-button--secondary" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="9" y="9" width="11" height="11" rx="2.5"/><path d="M5 15V6.5A2.5 2.5 0 0 1 7.5 4H15"/></svg> Copy</button>

Any direct svg child, or an element with ha-button__icon, is sized to 17px and never shrinks.

Icon only#

HTML
<button class="ha-button ha-button--secondary ha-button--icon" type="button" aria-label="Search"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="11" cy="11" r="6.5"/><path d="m20 20-4.2-4.2"/></svg></button>
<button class="ha-button ha-button--primary ha-button--icon" type="button" aria-label="Next"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button>
<button class="ha-icon-button" type="button" aria-label="Menu"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 7h16M4 12h16M4 17h16"/></svg></button>
<button class="ha-icon-button ha-icon-button--plain" type="button" aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18"/></svg></button>

Icon-only buttons must have an aria-label.

States#

Disabled link
HTML
<button class="ha-button ha-button--primary is-loading" type="button" aria-busy="true">Saving</button>
<button class="ha-button ha-button--secondary is-loading" type="button" aria-busy="true">Saving</button>
<button class="ha-button ha-button--primary" type="button" disabled>Disabled</button>
<a class="ha-button ha-button--secondary" aria-disabled="true" role="link" href="#">Disabled link</a>

Loading keeps the button width, hides the label, and shows a spinner. Set aria-busy and keep the label in the DOM.

Full width#

HTML
<button class="ha-button ha-button--primary ha-button--block" type="button">Continue</button>

Button group#

A group wraps on tablets and stacks on phones. Add ha-button-group--cols for two equal columns under 480px when the labels are short.

HTML
<div class="ha-button-group">
  <a class="ha-button ha-button--primary" href="#">Contact me</a>
  <a class="ha-button ha-button--secondary" href="#">Download CV</a>
  <a class="ha-button ha-button--secondary" href="#">GitHub</a>
</div>

Narrow your window below 480px to see the stack.

Classes#

ClassPurpose
ha-buttonBase button. Always combine with a variant.
ha-button--primary, --secondary, --ghostVariants.
ha-button--sm, --lgSizes. Medium is the default.
ha-button--iconSquare icon-only button.
ha-button--blockFull width.
is-loading, [aria-busy="true"]Loading state.
ha-icon-button, --sm, --plainRound icon button with glass or no background.
ha-button-group, --center, --colsLayout for several buttons.

Accessibility#

  • The label and icon of every variant reach 4.5:1. Primary is white on accent-fill.
  • The focus ring follows the pill shape and uses the focus-ring token.
  • Disabled buttons use disabled or aria-disabled, drop pointer events, and lose hover and press effects.
  • The press scale is removed under reduced motion.

Do

  • Use one primary button per view.
  • Write labels as verbs: "Download CV".
  • Keep labels on one line.

Don't

  • Put an orange fill behind black text. White is the pair.
  • Use ghost for the main action.
  • Disable a button without saying why nearby.

Edit this page on GitHub

Type to search.