← All components
Grayscale Reveal
ImageGrayscale → color image reveal — grayscale(1) fades to grayscale(0) alongside opacity.
on scroll
trigger="inView"on mount
trigger="mount" delay=0.2Installation
One command drops the source into your repo — editable, with the provider and motion pulled in automatically.
npx shadcn add https://motion.asmitsah.dev/r/grayscale-reveal.jsonPrerequisiteInstall the provider base first
This component imports from @/lib/motion and needs <MotionProvider> mounted in your root layout — install the base once, before copying this component.
npx shadcn add https://motion.asmitsah.dev/r/provider.jsonStep 1Install the runtime dependency
npm install motionStep 2Copy the source into
components/motion/grayscale-reveal.tsxcomponents/motion/grayscale-reveal.tsx
Usage
Basic
Wrap an image — opacity and grayscale(1) → grayscale(0) settle together on durations.slow, the first time it's 30% in view.
Trigger on mount
Play immediately instead of waiting for scroll — for an above-the-fold hero image.
With delay
Offset a grid of images so they colorize in sequence rather than all at once.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | The image (or any element) that fades from grayscale to color. |
| trigger | "inView" | "mount" | "inView" | Animate on scroll-into-view (once) or immediately on mount. |
| className | string | — | Passed straight through — GrayscaleReveal becomes your layout element. |
| style | CSSProperties | — | Inline style passthrough. |
| delay | number | 0 | Seconds before this instance animates. |