Quick start
Three steps to a first page: include the files, write the markup, and check it against the three rules.
A complete page
Save this as an HTML file next to hairline.css and hairline.js, then open it in a browser:
<!doctype html>
<html lang="en" data-theme="light">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Notes</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,500;0,6..72,600;1,6..72,400&family=Noto+Serif+SC:wght@600;700;900&display=swap">
<link rel="stylesheet" href="hairline.css">
</head>
<body style="margin:0;background:var(--hao-bg);color:var(--hao-ink);font:400 17px/24px var(--hao-font-sans)">
<main class="hao-page" style="padding-top:48px">
<h1 class="hao-title-1-en" style="margin:0 0 24px">Today</h1>
<div class="hao-card hao-card--wave" style="max-width:390px">
<h2 class="hao-card__title">Morning note</h2>
<p class="hao-card__body">Mist outside the window. Write down the three things to do today, and let the rest wait.</p>
</div>
<p style="margin-top:24px">
<button class="hao-btn" data-hao-toast="Saved" data-hao-toast-ok>Save changes</button>
<button class="hao-btn hao-btn--plain" data-hao-open="confirm">Delete</button>
</p>
</main>
<div class="hao-scrim" id="confirm" data-hao-modal hidden>
<div class="hao-dialog" role="alertdialog" aria-modal="true" aria-labelledby="confirm-title">
<h2 class="hao-dialog__title" id="confirm-title">Delete this note</h2>
<p class="hao-dialog__body">You can’t undo this.</p>
<div class="hao-dialog__actions">
<button class="hao-btn hao-btn--tinted" data-hao-close data-hao-initial>Cancel</button>
<button class="hao-btn hao-btn--seal" data-hao-close>Delete</button>
</div>
</div>
</div>
<script src="hairline.js"></script>
</body>
</html>
How components are written
- Every class name starts with
hao-. Parts use two underscores (hao-card__title), and variants use two hyphens (hao-btn--tinted). - Native elements are used wherever they exist: a button is a
<button>, a switch is an<input type="checkbox">, a dropdown is a<select>. - Behavior is declared with attributes, like
data-hao-open,data-hao-close, anddata-hao-toastin the example above. See Behavior and scripts for all of them. - Every component page has a working demo. Select “Show code” to see its markup, then copy it.
Check three things when you’re done
- One touch of cinnabar. Does red appear only once on this screen: one seal, one badge, or one delete button?
- One scene per screen. Is there at most one scene, such as a pattern, a vignette, or a mounting? Task screens like settings and forms should have none.
- Shape follows the control. Does progress use only one motif, and does the moon appear in only one place?
The rules are set out in full in Design principles.
Make it your own
This system doesn’t belong to one product. When you use it, change three things: the seal character, the product name, and the date line of the signature. Keep the color, type, and spacing tokens and the three rules as they are. To make a real seal in seal script, see Seal design.