0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Build a long-form article: a title and byline, five sections, a quote, a code sample, a chart, tags and a list of further reading. You'll write it as plain HTML, then add a reading width, two small custom elements and a generated table of contents.
About 15 minutes · Uses all four layers: semantic HTML, layout attributes, custom elements, web components
The finished page. Scroll it and try the contents list.
Before you start
Make a folder, and in it one file called index.html. Paste in this starter and open the file in a browser. Everything in the tutorial goes inside <body>.
index.html
<!doctype html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1"><title>A year of rain</title><linkrel="stylesheet"href="https://unpkg.com/vanilla-breeze/dist/cdn/vanilla-breeze.css"><style>body { padding: var(--size-l); }</style></head><body><!-- Step 1 goes here --></body></html>
The <link> is the whole install for the first three steps. The one line of CSS keeps the text off the edge of the window, using a Vanilla Breeze spacing token; it is the only CSS you will write. There is no script tag yet: you add it in step 4, the only step that needs it. For npm and self-hosting, see Quick Start.
Step 1 — Semantic HTML
An article is mostly decisions about meaning, and HTML already has an element for each one.
The post is an <article> with a <header> for the title and byline and a <footer> for what comes after the text. The date is a <time> with a machine-readable datetime. The quote is a <blockquote> whose own <footer> names the speaker. The code is <pre><code>. The chart is an inline SVG in a <figure> with a <figcaption>, so the file needs no image. The further reading is a native <details>, which opens and closes without any script.
Three smaller choices matter later. Each <h2> gets an id you chose, so a link to #results keeps working if you reword the heading. Each tag is a link with rel="tag", and the author link has rel="author": both say what the link is, and the stylesheet draws tag links as pills because of it. The opening paragraph has class="lead", one of a few variant classes Vanilla Breeze defines for cases where HTML has no element.
Step 1: inside the body element
<main><article><header><p>Field notes</p><h1>A year of rain: what a backyard weather station taught me</h1><p>By <arel="author"href="https://example.com/authors/mara-lindqvist">Mara Lindqvist</a> · <timedatetime="2026-10-12">October 12, 2026</time> · 6 min read</p></header><pclass="lead">Twelve months ago I bolted a rain gauge to the fence, mostly to settle an argument about whether our street gets less rain than the airport. It does. That turned out to be the least interesting thing I learned.</p><h2id="why">Why measure your own weather</h2><p>The official station for our town sits at the airport, nine miles away and two hundred feet lower. Its numbers are accurate for the runway. They are a rough guess for my garden, which sits behind a ridge that splits most summer storms in two.</p><p>I wanted to know how rough. A gauge of my own would answer that, and it would tell me when the water butts were about to run dry instead of after.</p><blockquote><p>The forecast tells you what the sky will do over the county. The gauge tells you what it did over your beans.</p><footer>Ines Okafor, who has kept the allotment records since 1998</footer></blockquote><h2id="hardware">The hardware</h2><p>The station is deliberately small. A tipping-bucket gauge counts rain in 0.2 mm steps, a sealed sensor reads temperature and humidity, and a single-board computer in a weatherproof box logs both every five minutes.</p><ul><li>Tipping-bucket rain gauge, mounted level and clear of the fence line</li><li>Temperature and humidity sensor inside a louvred shield</li><li>Single-board computer, powered from the shed</li></ul><p>The whole thing cost less than a decent pair of boots. The expensive part was the afternoon spent getting the gauge level.</p><h2id="reading">Reading the gauge</h2><p>Each time the bucket tips, a magnet closes a switch. The logger only has to count the pulses and multiply. This is the entire rain script:</p><pre><code>MM_PER_TIP = 0.2tips = 0def on_tip(channel): global tips tips += 1def rainfall_mm(): return round(tips * MM_PER_TIP, 1)</code></pre><p>A scheduled job writes <code>rainfall_mm()</code> to a file at midnight and resets the counter. Twelve months of data is a text file smaller than one phone photo.</p><h2id="results">What twelve months showed</h2><p>The garden received 523 mm of rain over the year. The airport reported 640 mm. The gap is not spread evenly: winter totals match within a few millimetres, and almost all of the difference comes from four summer storms that passed north of the ridge.</p><figure><svgviewBox="0 0 240 90"role="img"aria-labelledby="rain-chart-title"><titleid="rain-chart-title">Bar chart of monthly rainfall, wettest in November and driest in July</title><gfill="currentColor"><rectx="2"y="8"width="16"height="82"/><rectx="22"y="20"width="16"height="70"/><rectx="42"y="27"width="16"height="63"/><rectx="62"y="38"width="16"height="52"/><rectx="82"y="45"width="16"height="45"/><rectx="102"y="52"width="16"height="38"/><rectx="122"y="63"width="16"height="27"/><rectx="142"y="74"width="16"height="16"/><rectx="162"y="81"width="16"height="9"/><rectx="182"y="70"width="16"height="20"/><rectx="202"y="49"width="16"height="41"/><rectx="222"y="30"width="16"height="60"/></g></svg><figcaption>Monthly rainfall in the garden, November 2025 to October 2026. The tallest bar is 82 mm.</figcaption></figure><p>July was the surprise. The airport logged 48 mm that month and the garden logged 9. The beans noticed before I did.</p><h2id="lessons">What I would change</h2><p>I would mount the gauge on its own post from the start. For the first two months it sat too close to the fence, and a westerly wind was enough to shelter it. Those readings are marked as estimates.</p><p>I would also write the data down in two places. A power cut in March cost me three days, which I filled in from a neighbour's notebook. The notebook was right; the notebook is always right.</p><footer><ul><li><arel="tag"href="https://example.com/tags/weather">Weather</a></li><li><arel="tag"href="https://example.com/tags/gardening">Gardening</a></li><li><arel="tag"href="https://example.com/tags/hardware">Hardware</a></li></ul><details><summary>Further reading</summary><ul><li><ahref="https://example.com/guides/siting-a-rain-gauge">Siting a rain gauge: height, level and shelter</a></li><li><ahref="https://example.com/guides/tipping-bucket">How a tipping-bucket gauge works</a></li><li><ahref="https://example.com/notes/allotment-records">Twenty-five years of allotment rainfall records</a></li></ul></details></footer></article></main>
Check
The page is readable from top to bottom, and the quote, code block, caption and tag pills are already styled.
Click Further reading: it opens. That is the browser, not a script.
Make the window wide. The lines run the full width, headings sit tight against the text above them, and the tags are a bulleted list. Those are the three things step 2 fixes.
Step 2 — A reading measure with layout attributes
Long text needs a measure: a line short enough that your eye finds the start of the next one. It also needs rhythm, with more space above a heading than below it so each heading belongs to the text that follows.
data-layout="prose" does both. It caps the article at 65 characters per line, spaces its direct children, and gives the figure, the code block and the quote extra room. data-layout-centered puts the column in the middle of the page. You could get the width alone from data-layout="center" with data-layout-max="prose", but then you would have to space every heading yourself.
The rhythm reaches direct children only, so the lines inside the <header> and <footer> are still touching. Each becomes a stack with its own gap: tight in the header, where three lines form one unit, and looser in the footer. The tag list takes class="inline", the list variant that lays items out in a wrapping row without bullets. A layout attribute would arrange the items but leave the bullets, so the variant class is the right tool here.
Step 2: four opening tags change
<articledata-layout="prose"data-layout-centered><headerdata-layout="stack"data-layout-gap="xs">…</header><!-- lead paragraph and the five sections: unchanged --><footerdata-layout="stack"data-layout-gap="m"><ulclass="inline">…</ul><details>…</details></footer></article>
What changed
The text sits in a centered column. Resize the window: the column stays the same width until the window is narrower than it, then it fills the space.
Headings have clear space above them, and the chart is a sensible size because it fills the column, not the window.
The tags are a row of pills, with a gap between them and the further reading.
Step 3 — Custom elements where HTML has no word
Custom elements in Vanilla Breeze are new tag names styled by the same stylesheet. The ones in this step have no JavaScript. The test for using one: is there a thing on the page that HTML has no element for, and that you would otherwise build from a <span> and a class?
This article has two. "Field notes" is a category label: not a heading, not a link, just a small chip. That is <layout-badge>; data-variant="subtle" and data-color="primary" give it a quiet tint that follows the theme. The byline gets a <user-avatar> showing the author's initials in a data-fallback span. The name is printed right beside it, so the avatar is marked aria-hidden="true" and a screen reader does not read "ML" before "Mara Lindqvist".
The tags fail the test, so they stay as they are. They are links, HTML has an element for links, and rel="tag" already makes them pills.
Step 3: the article header
<headerdata-layout="stack"data-layout-gap="xs"><p><layout-badgedata-variant="subtle"data-color="primary">Field notes</layout-badge></p><h1>A year of rain: what a backyard weather station taught me</h1><p><user-avatardata-size="xs"aria-hidden="true"><spandata-fallback>ML</span></user-avatar> By <arel="author"href="https://example.com/authors/mara-lindqvist">Mara Lindqvist</a> · <timedatetime="2026-10-12">October 12, 2026</time> · 6 min read</p></header>
What changed
"Field notes" is a tinted chip above the title, and a small disc with the author's initials starts the byline.
There is still no script on the page. Both elements are CSS only.
Step 4 — Web components: a table of contents and heading links
Web components are the layer that needs JavaScript, so the test is stricter: does the reader get something the first three layers cannot give, and is the page still whole without it?
A five-section article passes twice. A list of its sections helps a reader decide where to start, but a list written by hand goes stale the first time you rename a heading. <page-toc> builds the list from the headings on the page. It needs each heading to have an id, which is why you wrote them in step 1. levels="h2" limits it to the section headings and data-title sets its label. Its scope is a CSS selector and it reads the first element that matches. The default is main; main article says exactly which article you mean, so the list stays right when the page later gains a second one, such as a comment or a related post.
The second is sharing a section. <heading-links> adds a link icon to each heading it contains; activating one jumps to that section and copies its address. It goes around the <article>, not inside it. Inside, it would become the article's only direct child and the step 2 rhythm would have nothing to space.
Add the script to the <head>, then the two elements:
Step 4: one script, two elements
<!-- in <head>, after the stylesheet --><scripttype="module"src="https://unpkg.com/vanilla-breeze/dist/cdn/vanilla-breeze.js"></script><main><heading-linkslevels="h2"><articledata-layout="prose"data-layout-centered><headerdata-layout="stack"data-layout-gap="xs">…</header><pclass="lead">…</p><page-tocscope="main article"levels="h2"data-title="In this article"></page-toc><h2id="why">Why measure your own weather</h2><!-- the rest of the article: unchanged --></article></heading-links></main>
Check
An "In this article" box lists the five sections. Click one: the page scrolls to it, the address gains #results, and that entry is marked as the current one.
In a window narrower than 64rem the box is a disclosure: click its title to fold it away. In a wider window it stays open.
Hover a section heading, or tab to it: a link icon appears. Click it and paste somewhere; you have the address of that section. On a touch screen the icons are always shown.
Turn JavaScript off and reload. The contents box and the link icons are gone and nothing is left in their place: you are looking at step 3. The headings still have their ids, so a link to #results still lands, and Further reading still opens.
What you learned
Start with the elements that say what each part is.
data-layout="prose" gives an article its measure and rhythm; nested groups such as the header and footer get their own stack.
Reach for a custom element when HTML has no element for the thing (<layout-badge>, <user-avatar>), and not when it does (tag links).
Add a web component when it gives the reader something new and the page is complete without it. <page-toc> and <heading-links> both leave step 3 behind when JavaScript is off.
Try it yourself
Number the article. Add data-numbered to the <article> and see what happens to the headings and the figure caption. No script is involved. Read the article element.
Show reading progress. Add a <reading-progress> element and scroll. Read reading-progress, then decide whether it passes the step 4 test for your page.
Keep the contents in view. Move <page-toc> out of the article into an <aside> beside it, so the current-section marker is visible while you read. Read the sidebar section of page-toc and data-sticky.