Reveal lens
Two layers in one frame and a round lens that shows the second through the first. The lens trails the pointer on a spring, opens wider while pressed and closes when the pointer leaves.

When to use
- Before and after, sketch and finish, wireframe and screen, print and photograph.
- Explaining what a filter, model or edit changed.
When not to use
- Comparisons people need to measure; use the image compare slider.
- Layers that differ in size or framing.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/reveal-lens
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
RevealLens
3 props
Also accepts the native props of its root element and a ref.
PropTypeDefaultDescription
reveal *ReactNode—The layer the lens shows: the photograph under the sketch, the finished screen under the wireframe.
label *string—Names the pair for assistive technology, e.g. "Wireframe and finished screen". Both layers are read.
radiusnumber88Lens radius in px; pressing opens it half again as wide.
Keyboard
- No custom key handling; Tab and the native activation keys do the work.
Accessibility
It exposes group semantics, with aria-label and aria-hidden kept in step with state.
Motion
- State changes animate with the library's shared durations and curves, so its timing matches every other part.
- Under reduced motion each change lands on its end state without movement; nothing is hidden or skipped.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/reveal-lens.mdThe index of every part is at /llms.txt.
More in Media
Image compareTwo images stacked with a draggable divider.Zoom lensA magnifier that follows the pointer, a finger or the arrow keys over an image to show detail.Ink spoilerText kept under a fine drifting ink until it is asked for. Press it and the ink blows outward from where you pressed while the words come through; press again to cover them.