Button
Native controls work. Demo links and submissions stay inside this specimen. This example scrolls horizontally at this width.
Source markup
<!-- @dsCard group="Actions" height=200 -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Button</title>
<style>
/* layout of the demo states only */
.states {
padding: var(--space-sm);
display: flex;
flex-direction: column;
gap: var(--space-md);
}
.states__row {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
gap: var(--space-md);
}
.states__cell {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: var(--space-2xs);
}
/* static copies of the real interaction rules, taken from bundle.css:
.btn--primary:hover and .btn:focus-visible. Same tokens, no new values. */
.btn--primary.is-hover {
background: var(--color-semantic-accent-hover);
box-shadow: var(--shadow-ring-amber), var(--shadow-glow-amber);
}
.btn.is-focus {
outline: var(--focus-width) solid transparent;
outline-offset: var(--focus-offset);
box-shadow: var(--shadow-focus-ring);
}
</style>
</head>
<body>
<div class="states">
<div class="states__row">
<div class="states__cell">
<span class="t-label">Primary / rest</span>
<button type="button" class="btn btn--primary">Get in touch</button>
</div>
<div class="states__cell">
<span class="t-label">Ghost / rest</span>
<button type="button" class="btn btn--ghost">See hosting plans</button>
</div>
<div class="states__cell">
<span class="t-label">Link / rest</span>
<button type="button" class="btn btn--link">Read the security statement</button>
</div>
</div>
<div class="states__row">
<div class="states__cell">
<span class="t-label">Primary / hover</span>
<button type="button" class="btn btn--primary is-hover">Get in touch</button>
</div>
<div class="states__cell">
<span class="t-label">Ghost / focus visible</span>
<button type="button" class="btn btn--ghost is-focus">See hosting plans</button>
</div>
<div class="states__cell">
<span class="t-label">Primary / disabled</span>
<button type="button" class="btn btn--primary" disabled>Get in touch</button>
</div>
</div>
</div>
</body>
</html>
The action control on every Noiz page: .btn with one of three weights, for the thing a reader should do next.
Use .btn--primary for the single most important action in a view, .btn--ghost for the secondary action beside it, and .btn--link for a quieter action in a card footer or a form’s .form__actions. A .btn may be an <a href> leading to another page, because a call to action is still an action. Use .link for navigation inside running prose.
The consumer provides the element, the classes and the label. Labels are sentence case and name the action. “Get in touch” is the live wording. An inlined SVG child is spaced by space-2xs. .btn--full-sm makes the control full width below 480px, for the page-foot call to action.
States and their tokens:
- Rest, primary: fill
color-semantic-accent-primary, labelcolor-semantic-text-on-accent. - Rest, ghost: transparent, border
color-semantic-border-strong, labelcolor-semantic-text-secondary. - Rest, link: label
color-semantic-accent-primary, no border, no inline padding. - Hover, primary:
color-semantic-accent-hoverwithshadow-ring-amberandshadow-glow-amber. This is one of the few places the phosphor glow is allowed. - Hover, ghost: border and label both move to
color-semantic-accent-primary. - Focus visible:
shadow-focus-ring, paired with a transparent outline atfocus-widthandfocus-offsetso a ring survives forced-colours mode. Nevershadow-focus-halo. - Disabled: opacity drops and pointer events stop.
Pair one .btn--primary with one .btn--ghost, never two primaries. On a filled accent, color-semantic-text-on-accent is the only ink allowed: color-semantic-text-primary and color-semantic-text-secondary both fail contrast on all five fills. Do not add a second glow to a view that already carries one.
Accessibility
Section titled “Accessibility”- Role: a native
<button type="button">for an action, an<a href>for a destination..btnsets no role, so no ARIA role is needed; never put.btnon a<div>. - Accessible name: the visible label. An icon-only
.btnhas no text, so give it anaria-label. - Keyboard: Tab reaches it, Enter activates either form, Space activates the
<button>. No Escape or arrow behaviour.[disabled]drops it from the tab order;aria-disabled="true"leaves it focusable, and both stop pointer events. - Target size:
.btnsetsmin-height: 44px, above the 24px floor of WCAG 2.2 SC 2.5.8..btn--linktakesmin-height: autobut keeps thespace-2xsblock padding, computing to about 30px. - Announcement: none. A
.btnannounces nothing on activation; the region it changes owns any live region.
Hand-written from themes/noiz/assets/css/components.css (.btn, .btn–primary, .btn–ghost, .btn–link).