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

article

Self-contained, independently distributable content such as blog posts, news articles, forum posts, product cards, or user comments.

Usage

Use the <article> element for content that:

  • Makes sense on its own, outside the context of the page
  • Could be syndicated or shared independently (RSS, social media)
  • Represents a complete, self-contained composition

Common uses include blog posts, news articles, product cards, forum posts, comments, and widgets.

Examples

Default

Basic article with header and content.

.blog

Optimized for long-form reading. The article is centred and capped at --prose-measure (default 65ch), the header gets extra space below it, and the footer is separated by a top border. It also gets the prose typography described under Prose typography.

.card

Card-style article with border, background, and padding.

.feature

Hero-style feature article with centered header.

.compact

Compact list-item style for article listings: a horizontal flex row with a bottom border (dropped on the last article). A leading image, picture, SVG or video keeps its size and gets a small radius; the other child (typically a <section> or <header>) fills the remaining width.

.nested

Nested articles for comments and replies with indentation.

data-numbered

Academic-style auto-numbering. CSS counters prefix h2–h4 headings with hierarchical numbers (1., 1.1., 1.1.1.) and prepend "Figure N:", "Table N:" and "Listing N:" labels to captions. The numbering runs through the whole article, across <section> elements. For numbered lists use <ol>; for legal-style § numbering use data-section-numbers.

What gets numbered

  • Headings: h2, h3 and h4 anywhere in the article, sections included. Headings inside a nested <aside> or <article> (a sidebar note, a comment) are left unnumbered.
  • Figures: a <figure> with a <figcaption>. Quote figures (figure.quote) are skipped, and a figure without a caption does not use up a number.
  • Tables: a <table> with a <caption>. Uncaptioned tables are not counted.
  • Listings: a captioned figure.code is counted separately as "Listing N".
  • Subfigures: a <figure> nested directly in another figure sits inline beside its siblings, and its caption is lettered (a), (b) and so on.

Number from h2 down. An h3 that comes before the first h2 renders as "0.1." because there is no h2 number yet.

Articles, sections and asides are normally container-query containers. A container's style containment would restart the counters in every section, so a numbered article and the sections and asides inside it are not containers; container queries inside resolve against the next container out, usually <main>. Adding data-container to one of them turns it back into a container, and numbering inside it then starts again from 1.

Styling and translation

Custom propertyDefaultEffect
--label-figure"Figure"Prefix for figure captions
--label-table"Table"Prefix for table captions
--label-listing"Listing"Prefix for figure.code captions
--numbered-styledecimalCounter style for the heading numbers, for example arabic-indic, devanagari, cjk-decimal or your own @counter-style name

Set them on article[data-numbered], typically per language:

The numbers are generated content in --color-text-muted. Screen readers read generated content, so the numbers are announced with the heading, which helps when a document cross-references "section 2.1".

data-section-numbers

Section-sign numbering for legal and policy documents, separate from the outline numbering of data-numbered. Each h2 is prefixed § 1, § 2, and each h3 beneath it § 1a, § 1b, in the interactive colour. Like data-numbered, the count runs across sections and skips headings in a nested <aside> or <article>. Set --sep-section to replace the § sign.

data-drop-cap

Adds a large decorative initial letter to the opening paragraph, a convention borrowed from illuminated manuscripts and editorial print design. The drop cap goes on the article's first direct <p>; if the article has no direct paragraph, it goes on the first paragraph of the first direct <section>. data-drop-cap also works on a single <p>.

Browsers that support initial-letter sink the letter into the first lines of text; others get a floated letter of about the same size. Both are logical, so in right-to-left text the cap sits on the right. Themes never add a drop cap on their own: only elements with data-drop-cap get one, and themes such as editorial and Swiss only change its colour, font and weight.

Styling hooks

Custom propertyDefaultEffect
--drop-cap-lines3Number of lines the letter spans
--drop-cap-colorvar(--color-primary)Letter colour
--drop-cap-fontinheritLetter font family
--drop-cap-weight700Letter font weight

The browser decides what ::first-letter covers: an opening quotation mark or other punctuation is enlarged together with the letter after it. Drop caps are designed for horizontal text; in a vertical writing-mode, test before using one. Screen readers read the paragraph normally, because the cap is a style on the real first letter.

data-prose

Long-form typography for markdown or CMS content you do not control: the reading line height, old-style numerals and hyphenation listed under Prose typography, plus floated images. Every image (or <picture>) that is a direct child of a paragraph floats to the inline-end, capped at half the content width, so text that shares the paragraph wraps around it. Headings (h2–h4), <hr> and the footer clear the float, so an image never spills into the next section.

CSS cannot see text, so a paragraph that holds only an image floats too. Wrap an image that should span the column in a <figure>.

data-prose, .blog or data-layout="prose"?

  • article[data-prose] styles the text: prose typography and image floats. It sets no width.
  • article.blog is the same typography plus a centred column capped at --prose-measure (65ch) with spaced header and footer. It does not float images. Combine both (class="blog" data-prose) for a centred column with floats.
  • data-layout="prose" / <layout-text> is layout: reading measure and vertical rhythm between blocks, on any element. It pairs with data-prose on the same article.

Prose typography (.blog and data-prose)

Both .blog and data-prose apply the same reading typography:

  • Line height of --prose-line-height (default 1.6)
  • Old-style, proportional numerals (font-variant-numeric: oldstyle-nums proportional-nums)
  • Body text stepped up to --font-size-l when the surrounding column (the nearest main, section, aside or other container) is at least 40rem wide, so the same article keeps body-size text in a narrow sidebar column
  • Automatic hyphenation with conservative limits. It needs a lang attribute on the article or any ancestor, usually <html>

data-highlights

Enables Medium-style text highlighting and private notes. data-highlights turns on the engine, which stores, restores and paints highlights. It renders no UI of its own: the selection toolbar comes from a <selection-menu> pointed at the article, holding a <highlight-wc> (colour palette) and a <note-wc> (notes). Select text, pick a colour, and the highlight is saved to localStorage. Highlights with notes get a margin annotation; click it to open or edit the note.

data-highlights (custom colors)

List the palette in data-highlights-colors (which colours the engine paints) and in the colors attribute of <highlight-wc> (which swatches the toolbar offers), then define a --highlight-{name} custom property for each name in your stylesheet. Names may contain letters, digits, hyphens and underscores. Each article paints its own palette, so several articles with different palettes can share a page, and a --highlight-{name} set on one article applies only to it.

data-highlights (readonly)

Add data-highlights-readonly to render stored highlights without allowing new ones. No <selection-menu> is needed.

Variants

Class Description
.blog Long-form reading layout with 65ch max-width, spaced header/footer, prose typography
.card Card styling with border, background, padding, and rounded corners
.feature Grid layout with centered header for hero-style content
.compact Flexbox horizontal layout for article listings; media keeps its size, text fills the rest
.nested Indented with left border for threaded comments/replies
data-numbered Academic-style auto-numbering for h2-h4 headings, figures, tables, and code listings
data-drop-cap Large decorative first letter on the opening paragraph
data-prose Prose typography plus floated paragraph images for markdown/CMS content
data-highlights Text highlighting and private notes with localStorage persistence (UI via <selection-menu>)
data-section-numbers Section-sign (§ 1, § 1a) numbering for h2 and h3

Accessibility

  • <article> has the article role, a document-structure role rather than a landmark. It does not appear in landmark navigation, though some screen readers let users move between articles and announce their boundaries. Use <main>, <nav> and similar elements for landmarks
  • Always include a heading (h1-h6) to label the article content
  • Use <header> and <footer> within articles for structured metadata
  • Include <time> elements with datetime attributes for publication dates
  • Nested articles maintain proper heading hierarchy (avoid skipping levels)

Highlights API

The highlights engine initialises itself on every [data-highlights] element when the page loads, and on matching elements added later. It is included in the full bundle (main.js) and is lazy-loaded by the autoload bundle when a [data-highlights] element is present.

Attributes

Attribute Description
data-highlights Enables highlighting. An optional value becomes the storage key (default: the page pathname). Highlights are stored in localStorage under vb:highlights:{key}.
data-highlights-colors Comma-separated color names the engine paints. Each maps to a --highlight-{name} CSS custom property. Default: yellow,green,blue,pink. Match it with <highlight-wc colors>.
data-highlights-readonly Renders stored highlights but disables creating new ones.

Events

Event Detail Description
highlights:selected { text, rect } Fired when the user finishes a non-empty text selection inside the article (not in readonly mode). rect is the selection's bounding DOMRect. Use it to wire your own UI instead of <selection-menu>
highlights:added { id, text, color, note } Fired when a new highlight is created (note is always empty here)
highlights:removed { id } Fired when a highlight is deleted with removeHighlight() (not by clearAll())
highlights:unplaced { highlights } Fired after stored highlights load, when the text of one or more is no longer in the article. Those highlights stay in storage and are tried again on the next load.
highlights:note-changed { id, note } Fired when a note is added or edited
highlights:clicked { id, highlight } Fired when an existing highlight or its margin annotation is clicked. highlight is a copy of the stored record (id, text, color, note, startOffset, endOffset, created)
highlights:request-note { id, highlight, controller } Fired when a margin annotation is clicked, asking for the note editor. <note-wc> listens for this; controller is the article's highlights controller

All events are dispatched on the article and bubble.

JavaScript API

The package does not export the highlights controller and it is not on window.VB. Programmatic access goes through <highlight-wc>, whose methods delegate to the article's controller. A standalone <highlight-wc for="…"> binds as soon as it connects; one inside a <selection-menu> binds when it creates its first highlight. The controller also arrives as detail.controller on highlights:request-note.

CSS Custom Properties

Property Default Description
--highlight-yellow oklch(95% 0.12 102) Yellow highlight color
--highlight-green oklch(93% 0.08 156) Green highlight color
--highlight-blue oklch(88% 0.06 254) Blue highlight color
--highlight-pink oklch(90% 0.06 343) Pink highlight color

Progressive Enhancement

  • No JS — data-highlights is inert and the toolbar elements render nothing; the article reads normally
  • No CSS Highlight API — falls back to <mark> wrapping, painted with the same --highlight-{name} colours
  • No localStorage — highlights work for the current session but are not persisted

Related

↑