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 weekly analytics dashboard: four key metrics, a chart of page views and a table of projects you can sort. You'll write it as plain HTML with two real tables first, so it is complete before any JavaScript runs.
About 15 minutes · Uses all four layers: semantic HTML, data-* attributes, CSS-only custom elements, web components · JavaScript is added in step 4
The finished page. Select a column heading in the Projects table to sort by it.
Before you start
Make a folder, and in it one file called index.html with this in it. Open the file in a browser and keep it open: after each step, save and reload.
index.html
<!doctype html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1"><title>Dashboard</title><linkrel="stylesheet"href="https://unpkg.com/vanilla-breeze/dist/cdn/vanilla-breeze.css"><style>body { padding: var(--size-l); }</style></head><body><!-- Everything in steps 1 to 3 goes here --></body></html>
That is the whole setup: one stylesheet, always the newest release because the URL names no version, and one line of CSS that keeps the content off the edge of the window using a Vanilla Breeze spacing token. It is the only CSS you will write. The other ways to install are in the Quick Start.
There is no <script> tag yet. In this series the script is added only in the step that needs it. On this page that is step 4, and until then everything you see is HTML and CSS.
Step 1 — Write the page in semantic HTML
A dashboard is a heading, a few numbers and some data. Write exactly that. Each metric is an <hgroup>: a heading with the paragraphs that belong to it. The number is the heading, because it is the headline of the group; the label comes before it and the change since last week after it. Each number sits in a <data> element whose value holds the raw figure.
The decision that matters most is the data. A chart is a picture of a table, so write the table: one row per day, with the day as a row header. The projects list is a table too. Both get a <caption>, which names the table for screen readers and will later become the chart's title. Because the data is in the HTML, the page is already complete.
Dates go in <time> with a machine-readable datetime. You'll need those values again in step 4.
Step 1: inside the body element
<header><h1>Dashboard</h1><p>Week of <timedatetime="2026-11-02">2 November 2026</time></p></header><main><sectionaria-label="Key metrics"><hgroup><p>Signups</p><h2><datavalue="1284">1,284</data></h2><p>Up 12.4% on last week</p></hgroup><hgroup><p>Active users</p><h2><datavalue="8927">8,927</data></h2><p>Up 4.1% on last week</p></hgroup><hgroup><p>Revenue</p><h2><datavalue="42300">$42,300</data></h2><p>Up 8.7% on last week</p></hgroup><hgroup><p>Churn</p><h2><datavalue="0.021">2.1%</data></h2><p>Down 0.3 points on last week</p></hgroup></section><table><caption>Page views by day</caption><thead><tr><thscope="col">Day</th><thscope="col">Views</th></tr></thead><tbody><tr><thscope="row">Mon</th><td>4,400</td></tr><tr><thscope="row">Tue</th><td>5,500</td></tr><tr><thscope="row">Wed</th><td>4,900</td></tr><tr><thscope="row">Thu</th><td>7,000</td></tr><tr><thscope="row">Fri</th><td>6,900</td></tr><tr><thscope="row">Sat</th><td>3,300</td></tr><tr><thscope="row">Sun</th><td>2,900</td></tr></tbody></table><table><caption>Projects</caption><thead><tr><thscope="col">Project</th><thscope="col">Status</th><thscope="col">Open tasks</th><thscope="col">Due</th></tr></thead><tbody><tr><td>Website redesign</td><td>Active</td><td>12</td><td><timedatetime="2026-11-20">Nov 20</time></td></tr><tr><td>Mobile app</td><td>In review</td><td>8</td><td><timedatetime="2026-12-04">Dec 4</time></td></tr><tr><td>Design system</td><td>Active</td><td>23</td><td><timedatetime="2027-01-15">Jan 15</time></td></tr><tr><td>Marketing site</td><td>Shipped</td><td>0</td><td><timedatetime="2026-10-30">Oct 30</time></td></tr><tr><td>Billing migration</td><td>Blocked</td><td>5</td><td><timedatetime="2026-11-13">Nov 13</time></td></tr><tr><td>Onboarding emails</td><td>Active</td><td>3</td><td><timedatetime="2026-11-27">Nov 27</time></td></tr></tbody></table></main>
Check
The stylesheet has set the typeface and the heading sizes, and styled both tables: a shaded header row, rules between rows, a muted caption.
Nothing is arranged. The four metrics sit in one long column and the text starts at the edge of the window. That is correct for now: the stylesheet does not guess a layout.
Every number on the finished dashboard is already on the page and readable.
Step 2 — Arrange it with data-* attributes
Layout in Vanilla Breeze is an attribute on an element you already have. Three values of data-layout arrange this page:
stack on <body> and <main>: an even vertical gap between their children, sized by data-layout-gap.
cluster on the <header>: a row that wraps. data-layout-justify="between" pushes the title and the date to opposite ends, and data-layout-align="baseline" lines up their text.
grid on the metrics section: as many columns as fit at a minimum width (data-layout-min="s" is 10rem), with no breakpoints to write. Four across on a desktop, two on a phone.
The metrics also get a class. Vanilla Breeze has no utility classes, but it has a few variant classes that say which kind of thing an element is. class="eyebrow" on an <hgroup> turns its first paragraph into a small uppercase label above the heading.
There is one new element. The projects table has four columns, and a table cannot shrink below its content, so on a narrow phone it would push the page sideways. Wrap it in a <section data-table-scroll> and the table scrolls inside the section instead. A scrolling area must be reachable by keyboard and have a name, which is what tabindex="0" and aria-labelledby pointing at the caption are for.
Step 2: the changed tags
<bodydata-layout="stack"data-layout-gap="l"><headerdata-layout="cluster"data-layout-justify="between"data-layout-align="baseline"> …</header><maindata-layout="stack"data-layout-gap="xl"><sectionaria-label="Key metrics"data-layout="grid"data-layout-min="s"data-layout-gap="m"><hgroupclass="eyebrow"><p>Signups</p><h2><datavalue="1284">1,284</data></h2><p>Up 12.4% on last week</p></hgroup><!-- class="eyebrow" on the other three too --></section><table>…</table><!-- page views: unchanged --><sectiondata-table-scrolltabindex="0"aria-labelledby="projects-caption"><table><captionid="projects-caption">Projects</caption> …</table></section></main>
Check
The date has moved to the right of the title, and the four metrics sit in a row with small coloured labels.
Narrow the window. The metrics drop to two columns, then one. You wrote no media query.
At about 320px wide the projects table scrolls sideways inside its own area and the rest of the page stays put.
Step 3 — Add custom elements for the tiles
The metrics are in a row, but nothing marks where one ends and the next begins. A dashboard tile needs a surface: a border, a corner radius and padding. No attribute on an <hgroup> provides that, and in most frameworks this is where a <div class="card"> appears.
Vanilla Breeze uses a named element instead. Wrap each <hgroup> in a <layout-card>; data-variant="outlined" draws a border in place of the default shadow. The card is a child of the grid, so the four tiles come out the same height.
The status column gets the same treatment. Wrap each status in a <layout-badge> and pick a colour that matches its meaning: success for Active, info for In review, error for Blocked, and none for Shipped. The colour only reinforces the word, so the text stays.
Both are custom elements styled by the stylesheet alone. They have no behaviour, so there is still no script.
Step 3: one tile and one table row; repeat for the rest
<layout-carddata-variant="outlined"><hgroupclass="eyebrow"><p>Signups</p><h2><datavalue="1284">1,284</data></h2><p>Up 12.4% on last week</p></hgroup></layout-card><tr><td>Website redesign</td><td><layout-badgedata-color="success"data-variant="subtle">Active</layout-badge></td><td>12</td><td><timedatetime="2026-11-20">Nov 20</time></td></tr>
What changed
Each metric is a bordered tile, and the tiles in a row are the same height even when one label wraps.
Statuses are tinted pills. Blocked stands out without you reading the column.
Step 4 — Add web components for the chart and the sort
Before adding a web component, ask one question: does this page need behaviour that HTML and CSS cannot provide? Here the answer is yes, twice. Drawing a chart from numbers takes code, and so does re-ordering table rows when someone picks a column.
Both components work the same way: they wrap the table you already wrote and read it. This is the step where the script goes in.<data-table> is in the main script. Charts are a separate add-on, so they are not downloaded by pages that have none; the add-on is one more script and one more stylesheet. Add these three lines to the <head>:
Step 4: add to the head, after the first stylesheet
Wrap the page-views table in <chart-wc>. It reads the row headers as categories and the Views column as a series, draws an SVG chart, and uses the caption as the title. data-type="column" picks the chart and data-label-y names the vertical axis. With one series there is nothing for a legend to tell apart, so data-legend="false" switches it off. Pointing at a bar still shows its value in a tooltip. The table does not go away. It is hidden visually and stays in the page as the chart's text alternative, and it is what gets printed.
Wrap the projects table in <data-table>, inside the scrolling section, and mark each sortable column with data-sort and the kind of value it holds: string, number or date. "Nov 20" has no year, so it cannot be sorted as a date as written. Give each of those cells a data-sort-value with the same value as its datetime.
Step 4: wrap the two tables
<chart-wcdata-type="column"data-label-y="Views"data-legend="false"><table><caption>Page views by day</caption> …</table></chart-wc><sectiondata-table-scrolltabindex="0"aria-labelledby="projects-caption"><data-table><table><captionid="projects-caption">Projects</caption><thead><tr><thscope="col"data-sort="string">Project</th><thscope="col"data-sort="string">Status</th><thscope="col"data-sort="number">Open tasks</th><thscope="col"data-sort="date">Due</th></tr></thead><tbody><tr><td>Website redesign</td><td><layout-badgedata-color="success"data-variant="subtle">Active</layout-badge></td><td>12</td><tddata-sort-value="2026-11-20"><timedatetime="2026-11-20">Nov 20</time></td></tr><!-- data-sort-value on the other five Due cells too --></tbody></table></data-table></section>
Check
The page-views table is now a column chart with one bar per day.
Each Projects column heading has become a button with a sort arrow. Select Open tasks: the rows run 0, 3, 5, 8, 12, 23. Select it again and the order reverses. Select Due and the rows run from Oct 30 to Jan 15, which only works because of data-sort-value.
Use the keyboard: Tab reaches each heading and Enter or Space sorts. The new order is announced to screen readers.
Turn JavaScript off and reload. You are back at step 3: two plain tables, every number still there. Nothing is blank and nothing is broken.
What a visitor sees if the scripts do not load: the step 3 page.
What you learned
Put the data in the HTML. A chart and a sortable grid both start as a <table>, and the table is what remains when a script fails.
data-layout arranges an existing element: stack for vertical spacing, cluster for a wrapping row, grid for columns that reflow.
CSS-only custom elements such as <layout-card> and <layout-badge> add a surface when no attribute will. They need no script.
Web components wrap markup that already works. <chart-wc> and <data-table> read the table inside them, and the script tag arrives only with them.
Try it yourself
Filter the projects. Add data-filterable to the projects <table>. A search box appears above it, and typing "active" hides the other rows. Read data-table.
Compare two sources. Add a third column to the page-views table, name the two value columns Organic and Direct, and remove data-legend="false". The legend comes back, and selecting a name in it hides that series. Read chart-wc.
Swap a tile for a component.<score-card> is a web component made for metric tiles, with a trend colour and room for a sparkline. Replace one <layout-card> with it and compare what each gives you with JavaScript off. Read score-card.