Page Transition

Page changes revealed with the View Transitions API.

page-transition.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/page-transition.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/page-transition.json

3

Turn on the motion

npx @prequelui/cli@latest animate page-transition

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.

page-transition.tsx
import { PageTransition } from "@/components/prequelui/page-transition";

export default function Demo() {
  return (
    <PageTransition>
      {/* compose the parts exactly like the underlying primitive */}
    </PageTransition>
  );
}
import { PageTransition } from "@/components/prequelui/page-transition";

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

Animation

This component adds a behaviour that ordinary primitives do not provide. Its motion is continuous and interruptible: dragging, hovering and scrolling retarget the same animated values instead of restarting an animation.

  • Pointer-driven values are never re-created on render.
  • Releasing or leaving hands control back to the same spring.
  • Boucles et animations autonomes are paused when the tab or element is out of view.
  • Reduced motion keeps the state change and removes the travel.
spring 500 / 50pause off-screenpointer-awareinterruptible

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.

Page Transition

PropTypeDefault
childrenReactNode—
disabledbooleanfalse
transitionTransitionspring.press
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026