View Transitions Cross Framework
Overview
Build robust view transitions across major web stacks. Start from a minimal working transition, then layer custom CSS and framework-specific routing behavior.
Workflow
- Identify transition scope:
same-document (SPA),cross-document (MPA), orshared element. - Read
references/core-api-and-css.mdfor base API and pseudo-element behavior. - Read
references/support-matrix.mdand pick the integration mode:
framework-managedframework-assistedmanual
- Read exactly one framework reference:
references/astro.mdreferences/angular.mdreferences/nextjs.mdreferences/react-router-remix.mdreferences/nuxt.mdreferences/sveltekit.mdreferences/qwik.mdreferences/tanstack-router.mdreferences/vanilla-js.md
- Apply a pattern from
references/pattern-library.mdonly after the baseline flow works. - Add fallbacks and
prefers-reduced-motionhandling before finalizing. - Verify navigation direction, back/forward behavior, and unsupported-browser behavior.
Implementation Rules
- Guard every
startViewTransitionusage and provide a no-animation fallback. - Keep the update callback fast; do expensive async work before starting the transition when possible.
- Keep each
view-transition-nameunique among simultaneously rendered elements. - Use cross-document transitions only for same-origin pages that opt in via CSS.
- Avoid running two transition systems on the same update path (for example manual DOM transitions plus framework-managed transitions).
- Respect reduced-motion users by shortening or disabling heavy motion.
Debugging Checklist
- Confirm the route/state update happens inside the intended transition boundary.
- Confirm no duplicate
view-transition-namevalues are active at once. - Confirm pseudo-elements exist with DevTools during the transition:
::view-transition-group(...)::view-transition-old(...)::view-transition-new(...)- Confirm transition callback does not throw or reject.
- Confirm browser support and fallback path in non-supporting browsers.
Resource Map
references/core-api-and-css.md: API lifecycle, pseudo-elements, custom CSS strategy, accessibility and fallback.references/support-matrix.md: integration choice by framework and maturity.references/astro.md:<ClientRouter />,transition:*directives, lifecycle hooks, fallback settings.references/angular.md: router-level view transitions viawithViewTransitions.references/nextjs.md: React<ViewTransition>, Next.jsexperimental.viewTransition, caveats and production posture.references/react-router-remix.md: route transition APIs for React Router and Remix.references/nuxt.md: Nuxt configuration and per-page control.references/sveltekit.md:onNavigateintegration pattern with native API.references/qwik.md: Qwik City defaults andqviewTransition.references/tanstack-router.md: navigate options and router-level defaults.references/vanilla-js.md: direct SPA/MPA implementations without framework abstraction.references/pattern-library.md: reusable animation recipes and safe defaults.references/framework-comparison-recipes.md: same animation recipe implemented across five stacks for copy/paste starts.
Expected Output Style
When implementing for a user request:
- Produce runnable code first.
- State exactly which transition type is implemented (
SPA,MPA, shared element). - Include fallback behavior and reduced-motion handling.
- Mention one concrete verification step the user can run immediately.