Zoom

An entrance that scales from half size with a spring.

zoom.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/zoom.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/zoom.json

3

Turn on the motion

npx @prequelui/cli@latest animate zoom

The CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.

Usage

Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.

zoom.tsx
import { Zoom } from "@/components/prequelui/effects/zoom";

export default function Demo() {
  return (
    <Zoom initialScale={0.5} className="rounded-2xl bg-accent p-8">
      Zoom
    </Zoom>
  );
}
import { Zoom } from "@/components/prequelui/zoom";

export function Variant() {
  return (
    <Zoom tempo={1.2}>
      …
    </Zoom>
  );
}

Animation

The element arrives from half size on the entrance spring. Scale is a transform, so the entrance never reflows the surrounding layout; the origin stays centred unless the component is composed with a different transform origin.

  • Entrance spring: stiffness 200, damping 20.
  • Initial scale and final scale are configurable.
  • The list variant staggers the children by holdDelay.
  • Reduced motion replaces the scale with a fade.
spring 200 / 20scale 0.5 → 1staggered listfade fallback

API Reference

Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.

Zoom

PropTypeDefault
initialScalenumber0.5
scalenumber1
delaynumber0
inViewbooleanfalse
inViewOncebooleantrue
inViewMarginstring"0px"
transitionTransitioncomponent spring or tween
asChildbooleanfalse
classNamestring—

Zooms

PropTypeDefault
holdDelaynumber0
childrenReactElement[]—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026