Philosophy
Most CSS frameworks ignore print entirely, leaving you to write a separate print stylesheet. VB takes the opposite approach: the print layer ships inside main.css and activates automatically via @media print.
The design principle is works by default, enhance when needed:
- Default — every page gets a clean print reset (black text, no shadows, linearized layout). No attributes required.
- Enhanced — pages intended for print (articles, invoices, reports) add
data-print on <body> to unlock @page rules, page numbers, and section breaks.
- Granular — individual elements can be shown, hidden, or protected from page breaks with data attributes.
Because VB’s design tokens drive all colors and spacing, the print layer only needs to reset the tokens — every element using them automatically adapts to paper.
Page Modes
For pages designed to be printed, set data-print on <body> to activate a named mode with CSS @page rules.
| Value |
Effect |
Use case |
article |
Wide margins, page numbers (bottom center), no number on first page, section breaks |
Blog posts, documentation |
invoice |
Tight margins, A4 portrait |
Invoices, receipts |
report |
Left/right page awareness, binding margin, page numbers in outer corners |
Multi-page reports, booklets |
none |
Hides the entire page from printing |
Dashboards, app shells |
Article
Long-form content with page numbers and section breaks. Each direct <section> starts on a new page.
Invoice
Tight margins optimized for A4 portrait paper.
Report
Left/right page awareness with binding margin for double-sided printing.
Page Breaks
VB automatically protects tables, figures, blockquotes, code blocks, and list items from splitting across pages. For manual control:
| Attribute |
CSS effect |
data-break-before |
break-before: page |
data-break-after |
break-after: page |
data-break-avoid |
break-inside: avoid |
<section data-break-before> <h2>Chapter 2: Methods</h2> ...</section> <figure data-break-avoid> <img src="chart.svg" alt="Results chart"> <figcaption>Figure 1: Quarterly results</figcaption></figure>
Opting Out
To print a page exactly as it appears on screen — with theme colors, shadows, and layout intact — add data-print-raw to the <html> element:
<html lang="en" data-print-raw>
This disables all VB print optimizations. The @page margin rules still apply (they cannot be scoped to a selector), but everything else is skipped.
The <print-page raw-toggle> component exposes this as a user-facing checkbox.