Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

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…

Read the release notes

data-layout

Component-level layout primitive. Drop on any element to apply a named layout (stack, cluster, grid, center, cover, sidebar, columns…) without wrapping in a custom element. Same surface as the layout-* custom elements; better semantics.

Overview

The data-layout attribute applies one of VB's named layout primitives to any element. It's the attribute form of the <layout-*> custom-element family — same engine, better semantics. Use <article data-layout="stack"> when the element you already have is the right semantic container; use <layout-stack> when you need a generic wrapper.

This page is the complete reference: every value, every data-layout-* modifier with its per-layout meaning, and the general-purpose layout attributes. The tables are generated from the layout CSS at build time, so they list exactly what the stylesheets implement.

Whole-page templates on <body> are a separate attribute, data-page-layout. data-layout is for components inside the page.

Usage

Put the value on the element you want to lay out; modifiers (data-layout-gap, data-layout-align, …) tune it without changing its kind.

Values are a closed vocabulary. A value a layout doesn't list matches no CSS and silently falls back to the default, so the vb/layout-attr-value conformance rule rejects it. For a genuine one-off, set the public custom property inline: style="--layout-min: 20rem" (grid and cover), --layout-threshold (switcher) or --layout-content-min (sidebar).

Layout values

Component layouts with an element twin

Each of these is defined once as :is(layout-x, [data-layout="x"]), so the two forms share every modifier. The element pages have the long-form explanations and demos for each.

ValuePatternResponsiveElement twin
stackVertical flow with a consistent gapNone needed: always one column<layout-stack>
clusterHorizontal row that wrapsIntrinsic: items wrap when the row runs out of room<layout-cluster>
gridAuto-fit grid by minimum column widthIntrinsic: column count follows the element’s own width<layout-grid>
centerCentered column with a max width and guttersNone needed: the max width caps, the gutters stay<layout-center>
coverPrincipal content vertically centered in a minimum block sizeNone needed<layout-cover>
sidebarSidebar beside contentContainer: wraps when the content column would drop below its minimum share<layout-sidebar>
switcherRow that becomes a column below a thresholdContainer: switches at data-layout-threshold of its own width<layout-switcher>
reelHorizontally scrolling rowNone: scrolls instead of wrapping<layout-reel>
columnsCSS multi-column reading flowContainer: drops to fewer columns as its own width shrinks<layout-columns>
proseReading column with typographic rhythm (the element is <layout-text>; there is no data-layout="text")Container: measure released to 100% in containers under 30rem<layout-text>

Attribute-only component layouts

These have no element twin. Each is described in Attribute-only layouts below.

ValuePatternUse onDefaultsResponsive
splitTwo columns at a fixed ratioAny elementEqual columns, gap xl, align-items: centerViewport: one column below 48rem unless data-layout-nowrap
mediaMedia object: a figure beside the contentAny elementFigure column sized to the figure, gap m, align startContainer: figure stacks above the content when the nearest query container is under 25rem
regionsHeader / content / footer column, no visual chromeAny element (cards, articles, panels)Header first, footer last, section grows; gap 0None needed
page-stackHeader / main / footer column; main grows so the footer sits at the bottom of short pagesA full-height container, usually <body>min-block-size: 100dvh, no gap, no modifiersNone needed
sidebar-leftnav beside the article<main> only16rem nav column, gap mViewport: below 48rem stacks to article, aside, nav unless data-layout-nowrap
sidebar-rightaside beside the article<main> only16rem aside column, gap mViewport: below 48rem stacks to article, aside, nav unless data-layout-nowrap

Layouts without a data-layout form

There is no data-layout="imposter", "card", "badge", "canvas" or "text".

ElementAttribute form
<layout-imposter>Element only: the element is the positioning box. Its data-layout-* modifiers appear in the table below.
<layout-card>Element only. For a surface on a semantic element use data-canvas.
<layout-badge>Element only (an inline label, not a layout container).
<layout-canvas>Attribute form is data-canvas (surfaces use bare data-* modifiers, not data-layout-*).

Page templates

Holy-grail, dashboard, app-shell, sidebar and landing page templates are data-page-layout values on <body>; they are not data-layout values. Inside the page, use data-layout on the regions (for example <main data-layout="sidebar-right">).

Attribute-only layouts

split

Two columns, equal by default (gap xl, vertically centered). data-layout-ratio takes 2:1, 1:2, 3:1, 1:3 or golden; data-layout-fill makes it at least the viewport height. Stacks below a 48rem viewport unless data-layout-nowrap is set. The demo at the top of this page includes ratio and golden splits.

media

The media object: a figure, img, picture or video child (or any child with slot="figure") goes in the figure column, sized to the figure, and spans the content rows. Every other child gets its own row in the content column, in DOM order; the last row takes up the slack when the figure is taller. Up to five content children are laid out this way; more still don't overlap, but the figure stops spanning them, so wrap long content in a section. data-layout-reverse puts the figure on the end side. Stacks (figure on top, also when reversed) when its nearest query container is under 25rem.

regions

Header, content and footer rows on any element, with no visual styling: a component layout for cards, articles and panels. header, section and footer children (or slot="header|content|footer") are placed by type: it is a flex column with the header first and the footer last, whatever their DOM position, and every other child in between in DOM order. A section (or slot="content") grows to fill the free space; with no section, the footer is pushed to the bottom instead, so equal-height cards keep their footers aligned. Visual order only: keep header and footer in reading order in the DOM.

page-stack

A full-height (100dvh) column whose direct <main> child grows, so the footer sits at the bottom on short content. No modifiers. Because <main> may only sit in <body> (or a div, form or custom element), this is the one data-layout value that normally goes on <body>. It is the minimal sticky-footer shape; for named page regions (nav, aside, sidebars) use data-page-layout instead.

sidebar-left / sidebar-right on main

On <main> only: a nav (left) or aside (right) sits beside the article; without that element it is one column. The sidebar column is 16rem (data-layout-sidebar-width: 12 / 16 / 20rem), the gap m. Below a 48rem viewport it stacks in the order article, aside, nav unless data-layout-nowrap is set. For a sidebar anywhere else, use data-layout="sidebar".

Modifier reference

Every data-layout-* modifier, with the layouts that read it. Values differ per layout where noted; a modifier on a layout that doesn't list it has no effect. Bare form is what the attribute does with no value; “Presence only” modifiers are booleans. Each row has an anchor, for example #modifier-gap.

ModifierValuesBare formDefaultLayouts and meaning
data-layout-alignstart · center · end · stretch · baseline · justify—Per layout
  • stack (start · center · end · stretch) default stretch: Cross-axis (inline) alignment of children. start/center/end make children content-sized (semantic sectioning children stop being query containers — see data-container).
  • cluster (start · center · end · stretch · baseline) default center: Cross-axis alignment.
  • reel (start · center · end · stretch) default stretch: Cross-axis alignment of items.
  • columns (justify): justify: justified text with automatic hyphenation. Justified narrow columns form uneven word gaps (WCAG 1.4.8, AAA): prefer ragged-right for long text.
  • split (start · center · end · stretch) default center: Block-axis alignment of the two columns (align-items).
  • media (start · center · end · stretch) default start: Block-axis alignment of the figure and the content.
data-layout-centeredBooleanPresence onlyOff
  • cover: Center the principal and text horizontally; header/footer (and data-layout-cover-top/-bottom) children still span the full width.
  • columns: No effect: columns are always centered (margin-inline: auto). Read by the shared typographic core.
  • prose: Center the container (margin-inline: auto).
data-layout-column-countauto · 1 · 2 · 3—1
  • columns: Number of columns. 2 and 3 are maximums: below about 14rem per column they drop to fewer columns (one on a phone). auto fits as many --column-min-width (38ch) columns as the element's own width allows.
data-layout-containBooleanPresence onlyOff
  • <layout-imposter>: Never larger than the containing block (the positioned ancestor, or the viewport when fixed) minus the margin on each side; scrolls inside when the content is bigger.
data-layout-content-mins · m · l—m
  • sidebar: Content column floor before wrapping: 40 / 50 / 60%. One-off: style="--layout-content-min: 45%".
data-layout-cover-bottomBooleanPresence onlyOff
  • cover (on a child): Pin to the bottom (a <footer> child is pinned automatically).
data-layout-cover-topBooleanPresence onlyOff
  • cover (on a child): Pin to the top (a <header> child is pinned automatically).
data-layout-fillBooleanPresence onlyOff
  • split: At least the full viewport height (min-block-size: 100dvh), for full-height sign-in pages.
data-layout-fixedBooleanPresence onlyOff
  • <layout-imposter>: Position relative to the viewport instead of the containing block.
data-layout-gapnone · 3xs · 2xs · xs · s · m · l · xl · 2xl · 3xlcenter: bare = mPer layout
  • stack default m: Gap between children, on the shared size scale.
  • cluster default s: Gap between items, on the shared size scale.
  • grid default m: Gap between cells, on the shared size scale.
  • center off unless set: Become a full-width flex column (inline-size fills the parent minus the gutters) with this gap between children, on the shared size scale. Bare attribute = m.
  • cover default none: Minimum space between all children (top, principal, bottom), on the shared size scale. The principal's auto margins still centre it.
  • sidebar default m: Gap between the columns, on the shared size scale.
  • switcher default m: Gap between items, on the shared size scale.
  • reel default m: Gap between items, on the shared size scale.
  • split default xl: Gap between the two columns, on the shared size scale.
  • media default m: Gap between the figure and the content, and between content rows.
  • regions default none: Gap between the header, content and footer regions.
  • sidebar-left default m: Gap between the nav and the article.
  • sidebar-right default m: Gap between the article and the aside.
  • data-page-layout default m: Gap between the page regions.
data-layout-gutternone · s · l—m
  • center: Inline padding on each side: none, s or l. The default --size-m applies when the attribute is omitted; there is no m value. The box is content-box, so the gutter adds to the max width.
data-layout-intrinsicBooleanPresence onlyOff
  • center: Center narrower-than-max content intrinsically (flex column, align center).
data-layout-item-widths · m · l · xl · auto · full—auto
  • reel: Item width: auto (content), s / m / l / xl tokens, or full (100%).
data-layout-justifystart · center · end · between—start
data-layout-limit2 · 3 · 4——
  • switcher: Force the column layout once there are more than this many items.
data-layout-margins · m · l · xl——
data-layout-maxnarrow · normal · wide · prose—normal
  • center: Max inline size of the content box (box-sizing: content-box; the gutter is added outside): narrow (--content-narrow, 40rem), normal (--content-normal, 60rem), wide (--content-wide, 80rem) or prose (65ch).
  • columns (narrow · normal · wide): Same as data-layout-measure (ch-based, unlike layout-center's rem-based data-layout-max).
  • prose (narrow · normal · wide): Same as data-layout-measure (the prose attribute form spells it this way). ch-based — layout-center's data-layout-max="narrow" is 40rem, this one is 45ch.
data-layout-measurenarrow · normal · wide—normal
  • columns: Line measure (--measure-narrow / --measure-normal / --measure-wide). Count 1 caps the block width. Counts 2 and 3 cap each column, so the block is at most count × measure + gaps (without the attribute they fill the container). auto uses the measure as the column width.
  • prose: Line measure: --measure-narrow / --measure-normal / --measure-wide (45 / 65 / 80ch by default; data-fluid and the accessibility themes adjust the tokens). Released to 100% in containers narrower than 30rem.
data-layout-minxs · s · m · l · xl · auto—Per layout
  • grid (xs · s · m · l · xl) default m: Minimum column width before wrapping: 8 / 10 / 15 / 20 / 25rem. Tracks are clamped to the container (min(…, 100%)), so a grid narrower than the minimum shows one full-width column instead of overflowing. One-off lengths: style="--layout-min: 220px" (not inherited by nested grids).
  • cover (s · m · l · xl · auto) default xl: Minimum block size: 50 / 70 / 80vh, xl = 100dvh, auto = none. One-off: style="--layout-min: 65vh" (beats the token; registered inherits:false so it never reaches nested layouts; layout-grid reads the same property as its minimum column width).
data-layout-nowrapBooleanPresence onlyOff
  • cluster: Keep everything on one line; no wrapping. Items overflow a narrow container, so let it scroll (overflow-x: auto).
  • sidebar: Never wrap; the sidebar stays beside the content, also inside a narrow (< 40rem) data-page-layout main.
  • split: Keep two columns below 48rem (viewport) instead of stacking.
  • sidebar-left: Keep nav and article side by side below 48rem.
  • sidebar-right: Keep article and aside side by side below 48rem.
  • data-page-layout: Keep the template below 48rem instead of collapsing to one column.
data-layout-overlapxs · s · m · lcluster: bare = sOff
  • cluster: Overlap items (avatar groups) in DOM order, later items on top, each with a surface-coloured ring. Items after the first are pulled back by xs 0.25rem, s 0.5rem, m 0.75rem or l 1rem. Forces gap 0. Bare attribute = s. Use a ul with one li per avatar, aria-labelledby on the list and an aria-label on the "+N" chip.
data-layout-paddingnone · s · m · l · xl—Per layout
  • cover default m: Padding on all sides.
  • reel (none · s · m · l) default s: Padding on all sides (block padding leaves room for focus rings and shadows); the same value is the inline scroll padding.
data-layout-positionstart · center · end · bottom · bottom-end · bottom-start · top · top-end · top-start—center
data-layout-principalBooleanPresence onlyOff
  • cover (on a child): The vertically centered principal element. A sole child auto-centers without it.
data-layout-ratio1:2 · 1:3 · 2:1 · 3:1 · golden—equal (1:1)
  • split: Column ratio: 2:1, 1:2, 3:1, 1:3 or golden (1.618:1).
data-layout-reverseBooleanPresence onlyOff
  • switcher: Reverse the visual order when stacked (flex-wrap: wrap-reverse): the last item is on top once items wrap onto their own lines; the row keeps DOM order. Visual only — focus and reading order stay in DOM order, so use it only when the stacked order is presentational.
  • media: Figure on the end side. Visual only: DOM and reading order are unchanged.
data-layout-scrollbarBooleanPresence onlyOff
  • reel: Show a thin scrollbar. Hidden by default, except under forced colours and on touch-only (hover: none) devices, where it always shows.
data-layout-sideend——
  • sidebar: end: put the sidebar on the end side. Omit the attribute for the start side (there is no start value). nav/aside children keep DOM order (order: 1); the positional fallback reverses the row (flex-direction: row-reverse), so visual order then differs from DOM order.
data-layout-sidebar-widthnarrow · normal · wide—normal
data-layout-subgrid2 · 3 · 4grid: bare = 3Off
  • grid: Each child becomes a subgrid spanning 2, 3 or 4 rows (bare = 3; any other value also spans 3) so header/content/footer line up across siblings. The subgridded rows use the grid's row gap, so data-layout-gap also spaces the parts inside each child — set row-gap on the children to override. Any child works, including article/section (they are not query containers here unless they carry data-container, which opts them out of subgrid alignment).
data-layout-textBooleanPresence onlyOff
  • center: Center the text as well.
data-layout-thresholds · m · l—m
  • switcher: The switcher's own width below which the row becomes a column: 25 / 30 / 40rem. No container query is involved. One-off: style="--layout-threshold: 35rem" (not inherited by nested switchers).

Nested layouts

Modifiers apply only to the element they are on. Every layout host resets its private tokens, so a layout nested inside another starts from its own defaults: a bare data-layout="grid" inside a data-layout-gap="3xl" grid gets the default m gap, not 3xl. The --layout-min / --layout-threshold / --layout-content-min escape hatches don't inherit either.

General-purpose layout attributes

These aren't modifiers of one layout: they go on a child, or on any element, and work wherever the table says.

AttributeValuesApplies toEffect
data-layout-areacta · feature · heroA direct child of a grid with named areasPlaces the child in a named grid area. Areas that VB templates define:Header, nav, main, aside and footer children of data-page-layout are placed by element type and need no attribute.
data-layout-order-1 · 1 · 99A child of a flex or auto-placed grid layout (stack, cluster, grid, split, switcher, sidebar, reel, media, regions)order: -1 moves the child first, 1 after its unordered siblings, 99 last. No effect on children placed by named area (data-page-layout, main sidebar-left/right) or on the header and footer of regions, which stay first and last. Visual only: see Accessibility.
data-layout-stickyBooleannav / aside children of data-layout="sidebar" or <layout-sidebar>; header / nav / aside children of data-page-layoutSticky with its own scroll (header: sticky at the top). Active only when the page opts in with <html data-sticky>, which keeps --sticky-offset in sync.
data-layout-bleedBooleanA direct child of data-page-layoutSpans every template column (grid-column: 1 / -1). Does nothing elsewhere; inside reading containers use data-bleed.
data-bleedBooleanA direct child of data-layout="prose" / <layout-text>, data-layout="columns" / <layout-columns> or article[data-measure]; also section.heroBreaks out of the reading measure to the full inline size of the nearest query container (100cqi), spanning every column in a multi-column flow. On section.hero the background extends behind a transparent site header instead.
data-container (page)card · panel · media or bareAny elementcontainer-type: inline-size; card, panel and media also name the container. The escape hatch for main/article/section/aside children of cluster, reel, centered cover and start/center/end stack, which otherwise drop container-type so they size to their content, and of a data-layout-subgrid grid, where they drop it so they can be subgrids.
data-measurenarrow · wide or bare<article>Reading width only (centered, --measure-*: 45 / 65 / 80ch; bare = normal), without the vertical rhythm of data-layout="prose".
data-scroll-hintstart or baredata-layout="reel" / <layout-reel>Fades the inline edges to hint at overflow (mirrored in RTL). Where scroll-driven animations are supported each edge fades only while there is more content that way. start: only the end edge fades.

Related attributes with their own pages: data-canvas (surface on any element), data-container, data-layout-density (re-tokens the spacing scale for a subtree) and data-sticky.

Responsive behaviour

Most layouts respond to the space they are given, not to the viewport, so the same markup works in a sidebar or a full-width column:

  • Container / intrinsic: cluster and grid wrap by content; sidebar wraps when its content column would fall below data-layout-content-min; switcher flips at data-layout-threshold; columns drops columns; prose releases its measure in containers under 30rem; media stacks in containers under 25rem.
  • Viewport: split and main sidebar-left/right stack below 48rem (as do the data-page-layout templates). data-layout-nowrap opts out.

Under data-fluid the --size-* tokens are fluid, so data-layout-gap and data-layout-padding scale with the viewport; the breakpoints above stay fixed. See Fluid scaling.

Element vs attribute — pick what fits

Both forms feed the same rules and accept the same modifiers. Pick by the markup you already have:

  • Use data-layout when you already have a semantic element that should also be the layout container (<article>, <section>, <nav>, <ul>, <form>).
  • Use <layout-stack> / <layout-grid> / etc. when you need a generic wrapper purely for layout. See custom elements for the full family.

One difference: main, article, section and aside are container-type: inline-size query containers, whichever form they appear in. As children of content-sized layouts (cluster, reel, centered cover, a stack aligned start/center/end) they drop container-type so they don't collapse to zero width; add data-container (and an explicit width) to keep one as a query container. The Semantic Layouts guide walks through the attribute form in depth.

Accessibility

  • Visual order vs reading order. data-layout-order, data-layout-reverse (media, switcher) and the mobile collapse of main sidebar-left/right (article, then aside, then nav) change only the visual order. Screen readers and keyboard focus follow the DOM. Keep the DOM in a sensible reading order and use these only when the visual change is presentational (WCAG 1.3.2 Meaningful Sequence, 2.4.3 Focus Order). On sidebar-left, a DOM-first nav is shown last on small screens: give it a skip link or a clear heading.
  • Scroll regions. A reel whose items aren't focusable can't be scrolled with the keyboard. Add tabindex="0" and a name (<section data-layout="reel" aria-label="…" tabindex="0">).
  • Landmarks. data-layout changes no semantics. A <section> is a region landmark only when it has an accessible name (aria-labelledby); a <header> inside an article is not a banner.
  • Sticky regions. data-layout-sticky sidebars scroll on their own; their content stays in the tab order.
↑