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

VB's one callout primitive: note, info, tip, warning and danger boxes, with optional speech and notched shapes. markdown-viewer renders :::kind blocks with the same markup.

Overview

data-callout turns a block element into a callout: a tinted box with an accent border on its start edge. Its value is a token list holding one kind (the meaning and colour) and, optionally, one shape (the outline). It is CSS-only and works on any block element. Use <aside> for notes and warnings, and <blockquote> for a quoted speech callout.

This is the only callout in Vanilla Breeze. <markdown-viewer> renders its :::warning blocks as <aside data-callout="warning" role="note">. Markdown callouts and hand-written ones therefore look identical and use the same theme hooks.

Usage

Put the kind in the attribute and start with a visible title. The data-callout-title marker on the title paragraph gives it tighter spacing. The title states the meaning in words, so the callout does not rely on colour alone.

To give a kind a shape, add the shape as a second token:

Options

Kinds

TokenAccent / backgroundUse for
(none) or note--color-border-strong / --color-surface-raisedNeutral asides and general notes
info--color-info / --color-info-subtleBackground context
tip--color-success / --color-success-subtleShortcuts and recommendations
warning--color-warning / --color-warning-subtleThings that can go wrong
danger--color-error / --color-error-subtleData loss, security, anything irreversible

Shapes

TokenOutlineNotes
(none)Accent border on the start edge, rounded on the end sideWorks in every browser
speechRounded box with a tail at the bottom start cornerNo accent border. Reserves --callout-tail of extra bottom padding for the tail.
notchedBevelled top end cornerKeeps the accent border on the straight start edge

The shapes need CSS shape(). Browsers without it show the plain rectangular callout, which keeps the same colours. Packs can add shapes too: the journal pack adds sticky, a sticky note, under data-theme="journal".

Styling

Custom propertyDefaultEffect
--callout-accentSet by the kindColour of the start-edge border
--callout-bgSet by the kindFill. It accepts gradients. Shaped callouts paint it inside the shape.
--callout-tail1remHeight of the speech tail and of the padding reserved for it
--shape-bevel20pxSize of the notched corner cut. It is a shared shape token, and the cyber and kawaii themes change it.

Shapes are painted on a ::before layer behind the content. The callout itself is never clipped. Themes therefore set --callout-bg rather than background, and draw glows with filter: drop-shadow(), which follows the shape.

Accessibility

  • Say the kind in words. The colour is decoration. Start every callout with a visible title such as "Warning" or "Tip". <markdown-viewer> always renders one.
  • Pick the element for its meaning. An <aside> inside <main> or an article is a complementary landmark. Give it role="note" when it belongs to the surrounding text, as markdown-viewer does, so it does not add one landmark per callout. Use <blockquote> only for quotations.
  • Do not use it for live alerts. A callout is static content. For messages that appear in response to an action, use role="alert" or role="status" on the element that receives the text.
  • Focus rings survive. The shape is painted behind the content and nothing is clipped, so links and buttons inside keep their full focus outline.
  • Forced colours and print. Backgrounds are flattened or dropped, so every callout gets a real CanvasText (or currentColor) frame with a thick start edge. Shaped callouts become plain framed boxes.
  • Right-to-left. The accent border, the radii, the speech tail and the notch all follow the writing direction.

Examples

All kinds

From markdown

This renders as <aside data-callout="danger" role="note"><p data-callout-title><strong>Trust boundary</strong></p>…</aside>.

Shapes in context

↑