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

print-page

A print button with optional toggle to disable VB print style optimizations.

Overview

The <print-page> component wraps window.print() in a progressive enhancement button with a printer icon. It never appears on the printed page and optionally lets users toggle VB’s print style optimizations on or off.

By default (variant="icon") the button shows only a printer icon; the label — the element’s text or the label attribute — becomes its accessible name. Use variant="icon-label" to show the text as well. Without JavaScript, the element renders as inert text. With JavaScript, it becomes a functional print button.

Attributes

Attribute Type Default Description
raw-toggle Boolean — If present, shows a checkbox labeled “Print without VB styles”
data-label-raw String “Print without VB styles” Text of the raw-toggle checkbox (for localisation)
label String Element text or “Print this page” Button label; the accessible name in every variant
variant icon, label, icon-label icon Visual display mode. Use icon-label for a labeled button, label for text only.

Variants

Control the visual display with the variant attribute.

In Page Tools

The default icon variant is what <page-tools> expects for a compact toolbar appearance.

Raw Mode Toggle

When raw-toggle is present, the component adds a checkbox. If checked, it sets data-print-raw on the <html> element before opening the print dialog, which disables all VB print optimizations. The attribute is removed after printing.

This is useful for users who want to see the page print exactly as it appears on screen — with theme colors, shadows, and layout intact.

Custom Label

Set the button text via label or as the element’s text content. It is shown with variant="label" or variant="icon-label", and is always the accessible name.

Usage in Context

Place the component wherever makes sense. Its own stylesheet hides it in @media print — including raw-toggle prints, where VB’s print optimisations are switched off. Adding data-no-print is redundant but makes intent explicit.

Full-page Demos

See print styles applied to complete documents: Article, Invoice, Report

Accessibility

  • The component renders a native <button> — fully keyboard accessible.
  • The raw-mode toggle uses a native <input type="checkbox"> inside a <label>.
  • The icon is aria-hidden; the label is always the button’s accessible name (as aria-label).
  • With raw-toggle, the component sets role="group" on itself and names the group with the label (unless you provide aria-label/aria-labelledby).

Related

↑