Vanilla Breeze

← All tutorials · ~10 minutes · Layer focus: typography & reading

Tutorial: Blog post

Build a long-form article with prose typography, tag pills, a collapsible "further reading" section, and a sticky table of contents — everything you need for a readable blog template.

Step 1 — Just the article

An article is an article. Native HTML already has the elements we need: <article>, <header>, <blockquote>, <footer>. Start with the content.

Step 2 — Give it reading width

Long text needs a measure — a constrained line length that keeps eyes moving horizontally without getting lost. That's exactly what data-layout-max="prose" is for.

Values for data-layout-max on a center region: narrow, normal, wide, and prose. prose caps the line at 65 characters — the width research suggests for comfortable reading.

Step 3 — Custom elements for the flair

A few places call for a custom element: the tag pills in the header, and a clear "callout" surface for a key takeaway. <layout-badge> gives you the pill shape, and <layout-card> gives you the callout.

Still no JavaScript. The badges and card are pure CSS custom elements.

Step 4 — Add navigation helpers with web components

Two genuine-JS wins on a long article: a clickable table of contents that highlights the current section as you scroll, and a collapsible "further reading" group that saves vertical space. The first is <page-toc>, the second is a native <details> grouped by <accordion-wc>.

<page-toc> scans the article for headings, renders anchored links, and updates the active link as the reader scrolls. Without JavaScript it renders nothing — so the reader never sees a broken widget.

<accordion-wc> enhances native <details name="…"> groups with keyboard navigation and smoother transitions. If JavaScript fails, the browser's built-in exclusive-disclosure behavior still works — that's why we use name="" on the <details> elements.

What you learned