vercel-react-view-transitions
Guide for implementing smooth, native-feeling animations using React's View Transition API (`<ViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter/exit of components, animate list reorder, implement directional (forward/back) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view
Install
npx skills add https://github.com/vercel-labs/agent-skills --skill vercel-react-view-transitionsCSS Animation Recipes
Ready-to-use CSS for <ViewTransition> props. Copy into your global stylesheet.
This file contains the complete CSS recipe set for the patterns in this skill. Copy only what the app needs.
Timing Variables
Shared Keyframes
Fade
Usage: <ViewTransition enter="fade-in" exit="fade-out" />
Keep the shared fade keyframe opacity-only. If a specific morph needs softness, give that class its own blur keyframe so ordinary content reveals stay crisp.
Slide (Vertical)
Usage:
Directional Navigation
Separate Enter/Exit Classes
Single-Class Approach
Shared Element Morph
Usage: <ViewTransition name={product-${id}} share="morph" />
Note: Shared element transitions take raster snapshots. For text with significant size differences (e.g., <h3> → <h1>), the old snapshot gets scaled up, producing a visible ghost artifact. Use text-morph for text shared elements.
Text Morph
Avoids raster scaling artifacts on text by hiding the old snapshot and showing the new text at full resolution:
Usage: <ViewTransition name={title-${id}} share="text-morph" />
Scale
Usage: <ViewTransition enter="scale-in" exit="scale-out" />
Interactivity During Transitions
The ::view-transition overlay captures all pointer events. React shrinks it to zero when the root group doesn't animate, but in-flight animations still block clicks. To pass clicks/hover through even while animating:
Trade-offs: clicks can hit live elements under still-moving snapshots, and it only helps unnamed content — named participants are skipped by hit-testing for the transition's duration, no CSS override (csswg#10930). Weigh that before naming interactive elements; portal named popovers (see Isolate Elements from Parent Animations [blocked]).
No Root Cross-Fade (Live Root)
The root cross-fades on every transition, freezing unnamed content behind a stale snapshot — hover and active styles stop rendering until it settles. ::view-transition-new(root) is a live capture, so disabling the root animation keeps unnamed regions rendering (and, with the pointer-events recipe above, interactive):
Named and classed groups still animate — they stack above root. Trade-off: unnamed content swaps instantly, so regions that should fade need their own VT. This also removes the main reason to hand-name static chrome; keep names only for elements that must stack above animating groups.
Pairs well with enter-only reveals: skip the fallback-exit VT entirely (<ViewTransition enter="auto" default="none"> around the content, nothing on the skeleton) — the skeleton snaps out live while the content fades in.
Persistent Element Isolation
Layer multiple pinned groups with z-index tiers — chrome at 100, toasts/overlays that must beat everything at 200.
Backdrop-Blur Workaround
For elements with backdrop-filter, hide the old snapshot to avoid flash:
Floating Element Isolation (popovers, menus, tooltips, control clusters)
Same freeze as persistent chrome. A floating/interactive element left rendered while a background transition runs is otherwise captured in the root snapshot and flickers as it settles. Give it a real, unique view-transition-name (never none — that's the CSS default = no isolation) and:
Sliding Indicator (tab underline / segmented pill)
One shared-name indicator morphs between positions. Slide the group; disable old/new so the solid bar slides instead of cross-fading: