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

Skeleton

Skeleton loading patterns to display placeholder content while data is being fetched. Reduce perceived load time with animated placeholders.

Overview

Skeleton loaders create a visual preview of content that will appear, giving users an immediate sense of the page structure. They are preferable to spinners for content-heavy pages as they maintain layout stability and feel faster.

Vanilla Breeze draws skeletons from the markup you already have. Put data-loading="skeleton" on a container and each direct child becomes a placeholder block the size of its own content: text turns transparent, headings and buttons take a darker shade, and a shimmer sweeps across every block. Remove the attribute when the data arrives and the same elements show their real content, so nothing shifts.

Key features:

  • No skeleton classes: one attribute on the container, from src/utils/loading.css
  • Placeholder sizes come from the placeholder content itself, so widths vary naturally
  • Shimmer animation that stops under prefers-reduced-motion
  • Accessible loading states with aria-busy="true"
  • Works with layout primitives like <layout-stack> for structure

Text Placeholder

Display placeholder lines for text content like paragraphs. Each child is one block, so write placeholder text of different lengths to vary the widths. data-layout-align="start" lets each block shrink to its text instead of stretching to the full width.

Card Placeholder

A complete card skeleton with image placeholder, heading, text lines, and button. Use this pattern for product cards, blog posts, or any content card that loads asynchronously. A direct <img> child becomes the block, sized by its width and height, with the image itself hidden.

Table Placeholder

Table skeleton with real headers and placeholder rows. Put data-loading="skeleton" on each cell and wrap its placeholder text in a <span>: the span becomes an inline bar the length of its text, so columns keep their real widths. Use this when loading tabular data.

Skeletons in Feedback States

When a container switches between loading, empty, error and populated with data-state, show the skeleton as its loading feedback instead: an <output data-loading data-feedback="skeleton"> of .skeleton-line spans (from src/utils/feedback-states.css). It appears only while the container has data-state="loading". See Feedback States.

Configuration

Skeletons are configured with attributes, not classes:

Markup Effect
data-loading="skeleton" Each direct child becomes a placeholder block with a shimmer; text inside turns transparent
Heading child (h1–h6) Darker block (--color-border-strong) to show hierarchy
<button> or <a> child Darker block in the shape of the control
<img> or <svg> child Image-sized block; the image itself is hidden. An image is a replaced element with no ::after, so its block is static; wrap it in a <figure> if you want the shimmer on it too
data-loading (no value) Dims the existing content under a shimmer overlay, for refreshing data that is already shown
data-loading="minimal" Overlay with a subtle pulse instead of the sweep
output[data-loading][data-feedback="skeleton"] Loading feedback inside a data-state container, drawn with .skeleton-line

Accessibility

  • Add aria-busy="true" to loading containers. Remove the attribute when content finishes loading.
  • Include an aria-label describing the loading state so screen readers announce meaningful context (e.g. "Loading card").
  • Mark the placeholder content aria-hidden="true". Its text is only there to size the blocks; transparent text is still read aloud.
  • Disable placeholder buttons with disabled so they cannot take focus.
  • Use role="status" with a live region announcement when content finishes loading so assistive technology is notified.
  • The shimmer stops under prefers-reduced-motion: reduce; the blocks stay as static shapes.

Usage Notes

  • Swap, don't rebuild: Render the real elements with placeholder text, then replace the text and remove data-loading. The block sizes carry over, so the layout does not shift.
  • Layout stability: Match placeholder lengths and image dimensions to the real content to prevent layout shift (CLS) when content loads.
  • Only direct children: Nested elements are not drawn as separate blocks. Put the attribute on the element whose children are the shapes you want, as the table does per cell.
  • Duration: Use skeletons for loads under 3-5 seconds. For longer waits, consider progress indicators with estimated time.

Related

Feedback States

Unified empty, loading, and error states

Empty States

When there's no content to display

Error Pages

404, 500, and maintenance pages

↑