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

layout-stack

Vertical stacking layout with configurable gap. The fundamental building block for vertical rhythm.

Overview

A stack puts its children in a single column with a consistent gap between them. It is a flex column (display: flex; flex-direction: column) with no other spacing: children lose nothing and gain nothing except the gap.

The stack declares no align-items of its own, so children get the flex default, stretch: each one fills the stack's width. data-layout-align changes that; with start, center or end each child shrinks to its content.

Element and attribute forms

Any element can be a stack with data-layout="stack". The same data-layout-* modifiers work on both forms; the two below are identical.

Which to choose: use the attribute form when a semantic element already holds the column: a <form>, an <article>, a <section> or a list. Use <layout-stack> when there is no such element and you would otherwise add a wrapper, for example to group a label and its input inside a larger form. In the attribute form, main, article, section and aside are also container-query containers, which the element is not, so container queries inside the stack resolve against it. See data-layout for the full comparison and Semantic Layouts for the approach.

Attributes

Attribute Values Default Applies to Description
data-layout-gap none, 3xs, 2xs, xs, s, m, l, xl, 2xl, 3xl m both Gap between children, on the shared size scale.
data-layout-align start, center, end, stretch stretch both Cross-axis (inline) alignment of children. start, center and end make children content-sized; see sectioning children.

Child attributes

Attribute On Applies to Description
data-container main, article, section, aside both When the stack is aligned start/center/end, keeps the child as a query container. Give it an explicit inline size too, or it collapses.

Examples

Gap

The data-layout-gap attribute controls the spacing between stacked items.

Alignment

The data-layout-align attribute controls the inline alignment of items.

Sectioning children

VB makes main, article, section and aside query containers (container-type: inline-size). A query container has no intrinsic width, so in a stack aligned start, center or end, where children shrink to their content, it would collapse to zero width. The stack therefore removes container-type from such direct children so they size to their content. To keep container queries on one of them, add data-container and give it a width.

Form layout

Card content

Nested stacks

A nested stack starts from its own defaults: a bare inner stack gets the m gap, not its parent's.

Accessibility

  • The stack changes spacing only. It never reorders children, so reading and focus order are the DOM order.
  • <layout-stack> has no role and is ignored by assistive technology. When the group has meaning (a form, a list, an article), use the attribute form on that element so its semantics stay without an extra wrapper.
  • Children reflow with the column, so text zoom and narrow viewports need no extra handling (WCAG 1.4.10 Reflow).

Related

↑