Vanilla Breeze

pdf-viewer

A standalone <pdf-viewer> web component wrapping PDF.js with navigation, zoom, search, thumbnails, and dark mode. Drops into a Vanilla Breeze page with zero extra wiring.

Where to find it

Install

Or via CDN ESM:

Demo

The component picks up VB color, spacing, typography, radius, and shadow tokens automatically. Switch the active theme on this site to see the toolbar/sidebar/borders re-skin in real time. The PDF page itself stays white in both light and dark mode by PDF/print convention.

Quick reference

Common attributes

AttributeDescription
srcURL of the PDF document.
pageInitial page number (1-based).
zoomNumber ("1.5") or mode ("fit-width", "fit-page", "auto").
modelight or dark; omit to follow page/system preference.
viewsingle (default) or continuous.
show-thumbnails / show-search / show-toolbarToggle UI panels.
lazyDefer loading until the component scrolls into view.

See the README for the full attribute, method, and event reference.

VB token consumption

The component reads VB tokens directly. No mapping required:

SurfaceVB tokens consumed
Colors--color-surface, --color-surface-raised, --color-surface-sunken, --color-surface-hover, --color-border, --color-text, --color-text-muted, --color-interactive
Typography--font-sans, --font-size-2xs--font-size-l
Spacing--size-3xs--size-m
Borders & radii--border-width-thin, --radius-xs, --radius-s, --radius-m
Shadows--shadow-s, --shadow-m, --shadow-l

Per-instance overrides via --pdf-viewer-* custom properties (e.g. --pdf-viewer-accent-color, --pdf-viewer-toolbar-bg, --pdf-viewer-sidebar-width) always win over VB tokens.