Vanilla Breeze

content-lens

Universal switchable host for VB lens components. Wraps a set of light-DOM lens children and exposes reader controls to switch which one is active.

Overview

The <content-lens> component is the universal host for VB's lens family. It wraps any number of lens children (each carrying a data-lens-name attribute) and renders a reader-facing radio control so visitors can switch between views over the same underlying data.

Without JavaScript, every lens child is rendered stacked — the page remains usable.

Attributes

AttributeTypeDefaultDescription
data-lens-defaultstringfirst childLens to activate on first load
data-lens-controls"on" | "off""on"Render the reader chip group
data-lens-srcstringShared data URL forwarded to every child unless the child sets its own
data-lens-storagestringpathnameKey for sessionStorage so the reader's last choice persists per page
data-active-lensstringcomputedReflects the active lens (state, not config)

Events

EventDetailWhen
content-lens:change{ lens: string }Reader switches lenses (or programmatic setLens())

Reader sovereignty

The lens family follows VB's reader-sovereignty principle: the author defines the exposed view, the reader can always reframe. <content-lens> exposes the radio chips by default; authors who want to lock to a single view can set data-lens-controls="off", but the underlying data is still discoverable via the shared data-lens-src.