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-badge

Small status indicators, labels, and counts, with optional ribbon, notch, flag, double-arrow and stamp shapes. Perfect for tags, statuses, and notification counts.

Attributes

Attribute Values Default Description
data-size s, l — Size: s (type-scale token with an 11px floor) or l. Omit for the default size.
data-color primary, success, warning, error, info, brand, secondary, accent — Semantic or brand color.
data-variant subtle, outlined — subtle (mode-aware tint) or outlined (transparent with a border) instead of filled.
data-shape square, ribbon, notch, flag, double-arrow, stamp — square gives square corners instead of a pill. The other values are decorative shapes.

Colors

Semantic Colors

Use semantic colors for status indicators. They come from the --color-success, --color-warning, --color-error and --color-info tokens, so a theme can retune them. Keep the meaning in the badge text as well (see Accessibility).

Theme Colors

Use theme colors for decorative purposes like tags, labels, and categories. These colors adapt to the site's brand hues.

When to use which?

  • Semantic colors - Status indicators (success/error), system messages, anything where color conveys meaning
  • Theme colors - Tags, labels, categories, decorative badges where color is for visual variety

Variants

Choose between solid (default), subtle, or outlined styles. Subtle badges pair a tinted background with the matching --color-*-text ink. Outlined badges use that ink for the text and border. Both switch between light and dark values with the colour scheme and keep at least 4.5:1 contrast.

Sizes

Three sizes: data-size="s", the default, and data-size="l". The small size uses the type scale with an 11px floor, so it stays legible.

Shapes

data-shape also takes five decorative shapes for promotional labels, steps and stamps. They combine with every colour, variant and size. Shapes are drawn with clip-path: polygon() (the stamp's concave corners use shape() where supported and chamfered corners elsewhere), so they work in every current browser.

Value Shape
ribbonV cut into the inline-end edge, like a tag
notchV cut into the inline-start edge, like a bookmark
flagPoint on the inline-end edge, like a pennant
double-arrowPoints on both edges, breadcrumb style
stampConcave bites out of every corner, like a ticket or stamp

How shapes behave

  • Labels are never clipped. The notch depth is a fixed length, --badge-notch (default 0.75em), and the padding on the notched side grows by the same amount, so a long label stops short of the notch.
  • Right-to-left. Shapes follow the inline direction: in dir="rtl" the ribbon's notch and the flag's point move to the left along with the padding.
  • Outlined cannot draw a border along a slanted edge, so an outlined shape is filled with a light wash of its text colour instead.
  • Themes. The shape is painted on a layer behind the text, so set --badge-shape-fill (it accepts gradients) and use filter: drop-shadow() rather than box-shadow, which would draw a rectangle. The cyber and kawaii themes restyle shaped badges this way.

Usage Examples

Status Indicators

Notification Count

Tag List

Accessibility

  • Colour is never the only signal. A red badge reading “3” or a green dot means nothing to someone who cannot tell the colours apart. Put the meaning in the text (“Failed”, “Paid”, “Beta”), or add an icon with a text alternative.
  • Counts need context. A bare number next to “Messages” is read as “Messages 3”. Add visually hidden text so the count makes sense on its own: <layout-badge>3<span class="visually-hidden"> unread</span></layout-badge>.
  • A badge is static text. If its count changes while the page is open and the change matters, announce it through a live region (for example role="status" on a container) rather than relying on the badge alone.
  • Every colour and variant combination meets 4.5:1 text contrast in both light and dark mode with the default theme. If a theme overrides the status tokens, check its --color-*-text and -subtle pairs too.
  • Solid badges take their text colour from contrast-color(). Browsers without it get black or white text, whichever contrasts more with the badge background, worked out from the background itself. This holds in either mode and with any theme.
  • In forced-colors mode every badge gets a CanvasText border, because the system removes the background that would otherwise mark its edges. Shaped badges show the same rectangular border: the shape is decoration and its meaning must be in the text.
  • Shapes are painted on a layer behind the badge rather than clipping the badge itself, so when a badge sits inside a link or button the focus outline and the label stay whole. The shape fill is kept when printing.
  • A shape is not announced. “Sale” in a ribbon reads as “Sale”; do not rely on the shape (for example a flag pointing forward) to carry meaning.

Related

↑