crucıble

Caliper

Before/after comparison slider that clips a leading layer with a draggable divider. Machinist's-caliper hairline with tick marks, a knurled grip, a live vernier readout, and a 50% detent. Accepts arbitrary children, keyboard-accessible, hover/drag/autoplay modes.

motionfree

Installation

CLI

npx shadcn@latest add @crucible/caliper

Manual — install dependencies, then copy the source

npm install motion

Props

PropTypeDefaultDescription
beforeReact.ReactNodeLeading content — revealed from the start edge up to the divider (the "before").
afterReact.ReactNodeTrailing content — fills the frame beneath the leading layer (the "after").
initialnumber50Starting split as a percentage, 0–100.
mode"drag" | "hover""drag"drag requires a press to move the divider; hover follows the pointer on move.
orientation"vertical" | "horizontal""vertical"Divider axis. vertical splits left/right; horizontal splits top/bottom.
handlebooleantrueRender the knurled grip on the divider.
autoplaybooleanfalseSweep the divider back and forth on a timer while idle (ignored under reduced motion).
autoplayDurationnumber6Seconds for one full autoplay sweep, there and back.
colorstring"#f5f5f5"Beam / tick / grip color — the bright neutral hairline.
accentstring"#7dd3fc"Cool accent for the live readout and detent pulse.
beforeLabelReact.ReactNodeOptional short chip pinned to the leading side.
afterLabelReact.ReactNodeOptional short chip pinned to the trailing side.
onSplitChange(percent: number) => voidFires with the rounded split percentage whenever the divider settles.
beforeClassNamestringExtra classes for the leading (before) layer.
afterClassNamestringExtra classes for the trailing (after) layer.
Also accepts all props of Omit<React.ComponentPropsWithoutRef<"div">, "onChange">they pass through to the underlying element.

Honors prefers-reduced-motion with a designed static fallback, and passes className through.