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

Spacing and Density

One scale of nine sizes sets every gap and padding. How to pick a step, what each layout uses by default and how to tighten or loosen a whole region.

One scale

Spacing in Vanilla Breeze comes from nine tokens, --size-3xs to --size-3xl. Layout gaps, padding and the spacing inside components all read them. You name a step, not a number, so spacing stays consistent across a page and changes in one place.

Step Token Default Multiple of --size-unit
3xs--size-3xs0.125rem0.5
2xs--size-2xs0.25rem1
xs--size-xs0.5rem2
s--size-s0.75rem3
m--size-m1rem4
l--size-l1.5rem6
xl--size-xl2rem8
2xl--size-2xl3rem12
3xl--size-3xl4rem16

Every step is a multiple of --size-unit, which is 0.25rem. Change the unit and the whole scale moves with it. That is how fluid scaling and the large-text accessibility theme resize spacing.

The demo changes the gap of one grid, and the density of the region around it.

Gap

data-layout-gap sets the space between a layout's children. It takes a step name or none.

A useful habit: small steps inside a component (a heading and its text), medium steps between components, large steps between sections of a page.

Defaults

Leave the attribute off and each layout uses its own default.

Layout Default gap
Stack, grid, switcher, sidebar, reel, mediam
Clusters
Splitxl
RegionsNone
CoverNone. Its children are pushed apart by the free space.
CenterNone. Adding data-layout-gap turns the center into a column with that gap; the bare attribute gives m.
Page layoutsm, except app-shell and dashboard, which have none

Nested layouts start again

A gap applies to the element it is on and not to layouts inside it. A grid inside a stack with data-layout-gap="3xl" has the grid's default gap of m.

Padding and edges

Most layouts have no padding: they arrange children and leave the edges to their parent. These are the ones that do.

On Attribute Values Default
Coverdata-layout-paddingnone, s, m, l, xlm
Reeldata-layout-paddingnone, s, m, ls, so focus rings and shadows on the items are not clipped
Centerdata-layout-gutternone, s, lm on the inline sides
Imposterdata-layout-margins, m, l, xlNone. The distance from the edge it is pinned to.
Carddata-paddingnone, s, m, l, xlm
Canvasdata-paddingnone, s, m, l, xlSee the canvas page
<section>data-paddingBare, small, xsmall, noneNo padding without the attribute

The surfaces (card, canvas) and <section> use data-padding without the layout- part. On a section it sets the space above and below, for the bands of a marketing page, and it uses three separate tokens that grow with the viewport: --section-padding-normal (3rem to 6rem), --section-padding-small (2rem to 4rem) and --section-padding-xsmall (1.5rem to 3rem).

In your own CSS

Use the same tokens, so your components line up with the library's and follow density and fluid scaling.

To move the whole scale, set --size-unit. Every step is recalculated from it. A fixed unit of your own replaces the one a fluid preset sets, so use one or the other.

Density

data-layout-density replaces the size tokens for one region. Everything inside that reads a --size-* token becomes tighter or looser at once: gaps, card padding, button padding. Put it on <html> for a whole page or on any element for a part.

Value --size-m becomes Line height Suits
compact0.75rem1.4Dashboards, data tables, admin screens
(no attribute)1remUnchangedMost pages
spacious1.5rem1.8Landing pages, marketing sections

The other steps move by similar amounts. The attribute page has the full table. compact also makes --font-size-s a little smaller. No other type size changes.

What to watch for

  • It shifts the scale; it does not rename the steps. data-layout-gap="m" inside a compact region is 0.75rem. You do not rewrite your gaps.
  • Touch targets. On touch screens buttons and inputs keep a minimum height of 2.75rem whatever the density, but the space between them shrinks. Check a compact region on a phone.
  • It is not data-density. That attribute is a setting on one <table>, <dl> or tree nav and changes only that component's rows.
↑