Skip to content
Nana UI

Rental

Evidence Compare

Two photographs of the same thing, side by side, for a decision that rests on the difference — the kitchen at move-in and at move-out, a meter before and after a repair. Zoom and pan move both pictures together, so the same corner of each is always in view.

View .md Download

Each photograph carries what makes it evidence: when it was taken, by whom, and any note left with it.

Zoom with the buttons, with + and -, with a pinch, or with Ctrl and the wheel; drag or use the arrow keys to look around; 0 resets. A double click zooms in on the point clicked.

Both photographs share one view. Zoom in on the stain in the move-out picture and the move-in picture shows the same patch of wall, at the same size.

InputDoes
+ / - buttons, + / - keysZoom about the centre
Ctrl + wheel, pinchZoom about the pointer
Double clickZoom to 2× at the point, or back out
Drag, arrow keysLook around once zoomed
0, the percentage buttonBack to the whole picture

The wheel alone still scrolls the page; zooming on it would trap a reader scrolling past.

FieldMeaning
src, altThe photograph
labelWhat this side is — “Move-in”, “After repair”; defaults to Before and After
takenAtISO time the photograph was taken
takenByWho took it
noteWhat they said about it

Side by side when there is room, stacked when there is not; layout fixes either.

Photographs on this page are from Pexels: move-in by Max Vakhtbovych, move-out.

npm install @nana-tec/ui-components

Or copy the source in and own it:

npx @nana-tec/ui add evidence-compare
import "@nana-tec/ui-components/evidence-compare";
<nana-evidence-compare
label="Kitchen, Unit 4B"
earlier='{"src":"https://images.pexels.com/photos/8146149/pexels-photo-8146149.jpeg?auto=compress&cs=tinysrgb&w=1200","alt":"Kitchen with white walls and clean wooden floor","label":"Move-in","takenAt":"2025-03-01T10:00:00Z","takenBy":"Agent"}'
later='{"src":"https://images.pexels.com/photos/17139803/pexels-photo-17139803.jpeg?auto=compress&cs=tinysrgb&w=1200","alt":"Kitchen with damaged walls and debris on the floor","label":"Move-out","takenAt":"2026-09-30T15:20:00Z","takenBy":"Agent"}'
></nana-evidence-compare>
const el = document.querySelector("nana-evidence-compare");
el.addEventListener("nana-view-change", (e) => console.log(e.detail));

Properties

PropertyAttributeTypeDefaultDescription
earlierearlierEvidence | nullnullThe earlier photograph: src, alt, label, takenAt, takenBy, note
labellabelstring''What is being compared
laterlaterEvidence | nullnullThe later photograph, in the same shape as earlier
layoutlayoutEvidenceLayout'auto'auto sits the pair side by side when there is room and stacks it when there is not
maxZoommax-zoomnumber4How far in the zoom goes

Events

EventDescription
nana-view-changeThe zoom or position changed (detail.zoom, detail.x, detail.y)

Slots

SlotDescription
actionsControls beside the zoom buttons, such as a dispute or accept button

CSS parts

PartDescription
::part(base)The container
::part(toolbar)The title and zoom controls
::part(title)The comparison's name
::part(zoom)The zoom control group
::part(side)One photograph with its details
::part(frame)The window the photograph is seen through
::part(image)The photograph
::part(meta)The photograph's details

CSS custom properties

PropertyDescription
--nana-evidence-compare-ratioAspect ratio of each frame
--nana-evidence-compare-bgColour behind a photograph that does not fill its frame
Explore Evidence Compare interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook