Measured entry
motion-primitives-image-comparison
hover-effectspatialmotion on file
A client-side React compound component for revealing one image against another with drag, touch, or optional hover input. It ships as editable shadcn registry source and uses Motion for spring-driven clipping, Tailwind utility classes for layout, and a project-local cn helper for class composition.



Measured
Every value below was written by the harness on the run that produced the frames above. None of it is derived from the prose.
| Build | OK |
|---|---|
| Mount | OK |
| Console errors | 0 |
| Uncaught page errors | 0 |
| Horizontal overflow | clean at 375, 768, 1440 |
| Axe critical | 0 |
| Axe serious | 0 |
| Axe moderate | 0 |
| Axe minor | 0 |
| Gzip marginal | 67.3 KB (132.7 KB build, 65.4 KB baseline) |
| Bare mode | FAIL |
| Provider required | NO |
| Demo used | written from the component source API |
What the harness recorded
BARE BUILD
✗ Build failed in 29.58s error during build: [vite:load-fallback] Could not load <sandbox>/src/lib/utils (imported by src/cut/image-comparison.tsx): ENOENT: no such file or directory, open '<sandbox>/src/lib/utils'
Verdict
A focused, customizable image reveal that builds and mounts cleanly in the prepared harness. It needs a shadcn-style setup because the bare project cannot resolve its local utility import. Adopt it when the editable compound API justifies Motion and some accessibility follow-up.
Use it if
- You need an interactive before-and-after reveal for redesigns, edits, restorations, or product states.
- Your React app already uses Tailwind conventions and can accept copied registry source.
- You want separate image and slider subcomponents so the handle and overlays remain customizable.
Skip it if
- You need a package that works without project aliases, utility CSS, or a local class-merging helper.
- Keyboard operation and native range semantics are required without adding them yourself.
- You only need a static side-by-side comparison and do not want Motion in the client bundle.
- Your images cannot share a fixed, positioned container with deliberate sizing supplied by the caller.
Install
| Declared dependencies | motion |
|---|---|
| Missing on install | none |
| Bare install | fails once the shadcn-style helpers are removed, so it needs that setup |
| Provider | no provider required in the harness |
In a non-shadcn project, copy the component source, install Motion, provide Tailwind or replace its utility classes, and add a cn-style class-merging helper at the expected alias or change that import. Also supply container sizing and consider adding keyboard controls and slider semantics.
Source and credit
This page is a review, not a copy. The component source lives with its author and this site does not republish it. Read the license before you use anything.
Author repository
github.com/ibelick/motion-primitivesAlternatives
Other published entries for the hover-effect pattern, ordered by what they measured: mounts first, then clean axe scans, then bare-mode passes, then the smaller bundle.
- eldora-card-flip-hover3d
- Renders
- YES
- A11y
- 0
- Gzip
- 17.5KB
- Bare
- pass
- Prov
- NO
- uilayouts-btn-hover-left-flip3d
- Renders
- YES
- A11y
- 0
- Gzip
- 17.5KB
- Bare
- pass
- Prov
- NO
- uilayouts-btn-hover-down3d
- Renders
- YES
- A11y
- 0
- Gzip
- 17.6KB
- Bare
- pass
- Prov
- NO
- uilayouts-btn-hover-multiplegradient-glow
- Renders
- YES
- A11y
- 0
- Gzip
- 17.9KB
- Bare
- pass
- Prov
- NO
- magicui-cool-modespatial
- Renders
- YES
- A11y
- 0
- Gzip
- 21.8KB
- Bare
- pass
- Prov
- NO
- uilayouts-hovercard2gradient-glow
- Renders
- YES
- A11y
- 0
- Gzip
- 24.0KB
- Bare
- pass
- Prov
- NO