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

output

Displays the result of a calculation or user action. Semantically ideal for form validation messages, computed values, and dynamic results. Used extensively in the form-field custom element for validation feedback.

When to Use

  • Form validation messages (see form-field)
  • Calculated totals or results
  • Dynamic values that change based on user input
  • Displaying range slider values
  • Any result that is derived from other form controls

Why Output over div/span?

The <output> element is purpose-built for displaying results of calculations and user actions. It has three advantages that <div> and <span> lack:

  • Semantic meaning: Browsers and assistive technology understand that output contains a computed result
  • A live region by default: Output has the implicit role status, which carries aria-live="polite" and aria-atomic="true", so screen readers announce the whole new value when its content changes
  • Labelable and form-associated: A <label for> names it, form.elements lists it, and form.reset() restores its default value
  • for attribute: Records which inputs produced the result (readable from script as output.htmlFor). Browsers do not expose this relationship to assistive technology; use aria-describedby or aria-controls for that
Approach Semantics Accessibility Recommendation
<output> Result of action Implicit status live region, labelable Recommended
<span class="error"> None Requires manual ARIA Avoid
<div class="message"> None Requires manual ARIA Avoid

Basic Usage

Vanilla Breeze styles output as an inline-block element with monospace font, subtle raised background, and small border radius. Display a simple calculated or dynamic value:

Attributes

Attribute Purpose Example
for Space-separated IDs of the inputs the result is computed from. Metadata only (output.htmlFor); not exposed to assistive technology for="qty price"
form Associates with a form by ID form="order-form"
name Name in form.elements. An output is not submitted with the form — copy the value into a hidden input if the server needs it name="total"

Set the result through the value property (same as textContent). The markup content is its defaultValue, which form.reset() restores.

Style Variants

Four CSS classes control presentation:

Class Effect
(default) Inline monospace with subtle raised background
.block display: block with larger padding for full-width output
.inline No padding or background — blends into surrounding text
.highlight Brand-tinted background with interactive color text
.large Increased font size (var(--font-size-xl)) for prominent values

Variants can be combined: class="large highlight" or class="block success".

State Variants

Semantic colors for different message types. Each state pairs a subtle tinted background token (--color-success-subtle, --color-warning-subtle, --color-error-subtle) with its matching text token, so they follow light/dark mode and themes. Color is not the only signal: the text itself must say what happened. In forced-colors mode the tints are dropped and every chip gets a system-color border instead.

Class Use Case
.success Confirmations, completed operations (green tones)
.warning Caution messages, pending review (amber tones)
.error Validation errors, failures (red tones)

For Validation Messages

The primary use case in Vanilla Breeze. Pair with form-field and aria-describedby for CSS-only validation feedback. Inside form-field, output.hint and output.error are messages, not results: they skip the monospace chip and take form-field's small message styling. The same applies to output.error-summary, checkbox-group outputs, and the data-empty / data-loading / data-error feedback outputs.

With Range Slider

Display the current value of a range input. Keep the <label> pointed at the slider with for: a label that wraps an output labels the output (the first labelable element inside it), leaving the slider unnamed. The slider already announces its own value, so aria-live="off" stops the output from repeating every step.

Calculated Values

Display computed results from multiple inputs. The for attribute accepts a space-separated list of input IDs; give the output an id so a <label for> can name it.

Live Status Updates

An output is already a polite live region, so status text written into it is announced without extra ARIA. Keep the element in the page from the start and change its content; a live region inserted at the same moment as its text is often not announced.

Accessibility Notes

  • Implicit role="status": Changes are announced politely and atomically (the whole content is re-read). No aria-live is needed
  • Silence chatty outputs: For values that change on every keystroke or slider step, set aria-live="off" — the control already announces its own value
  • Name it with a label: <label for="output-id"> gives the output an accessible name; don't wrap a control and its output in one label
  • for is not an ARIA relationship: Browsers don't expose it to assistive technology
  • Link with aria-describedby: Connect inputs to their validation outputs so screen readers announce the message when the input is focused
  • Don't use for static content: Output is for dynamic/calculated values
  • Include meaningful content: Always have useful text, not just icons

CSS Reference

Message outputs (form-field hints and errors, the error summary, checkbox-group and feedback-state outputs) are excluded from all of these rules.

Related

  • form-field - Uses output for validation messages
  • meter - Visual gauge for scalar values
  • progress - Task completion indicator
  • input - Form inputs that output relates to
  • data - Machine-readable value for static data
↑