
View Transitions
Implement React View Transition API animations between routes and UI states so a Next.js app feels native-smooth.
Overview
View Transitions is an agent skill for the Build phase that implements the React View Transition API for animated route and UI state changes in React and Next.js apps.
Install
npx skills add https://github.com/itallstartedwithaidea/agent-skills --skill view-transitionsWhat is this skill?
- React ViewTransition component with browser cross-fade between states
- addTransitionType for classifying transition kinds in CSS
- Shared element transitions via view-transition-name across routes
- CSS pseudo-element control for animation timing and interruptibility
- Next.js App Router integration patterns for route changes
Adoption & trust: 1 installs on skills.sh; 18 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
Route changes in your React app feel like abrupt jumps, breaking context and making the product feel cheaper than native alternatives.
Who is it for?
Indie builders polishing React or Next.js client navigations who want browser-native morph animations without bespoke animation libraries.
Skip if: Static marketing sites with full page reloads only, or teams forbidden from relying on View Transition API support.
When should I use this skill?
Navigating between routes or UI states in React or Next.js where you want seamless animated transitions and optional shared-element morphs.
What do I get? / Deliverables
You get working ViewTransition wiring, typed transition classes, and shared-element patterns integrated with your App Router navigation.
- ViewTransition-wrapped navigation or state updates
- CSS and transition-type hooks for animation control
Recommended Skills
Journey fit
View transitions are a frontend implementation concern while you are building navigation and layout polish before launch. Frontend subphase fits React/Next UI work: ViewTransition component, CSS pseudo-elements, and shared-element morphs.
How it compares
Frontend navigation polish skill—not a generic CSS animation pack or backend routing tool.
Common Questions / FAQ
Who is view-transitions for?
Solo frontend-focused builders using React or Next.js who want smoother navigations and shared-element effects without hiring a motion designer.
When should I use view-transitions?
During Build while implementing App Router flows, list-to-detail pages, or state toggles that need continuous visual context.
Is view-transitions safe to install?
It guides UI code changes only; review the Security Audits panel on this page and test fallbacks in browsers without API support.
SKILL.md
READMESKILL.md - View Transitions
# View Transitions Part of [Agent Skills™](https://github.com/itallstartedwithaidea/agent-skills) by [googleadsagent.ai™](https://googleadsagent.ai) ## Description View Transitions implements the React View Transition API for seamless animated transitions between UI states and routes. This skill covers the `<ViewTransition>` component, `addTransitionType` for classifying transitions, CSS pseudo-elements for animation control, shared element transitions across routes, and integration with Next.js App Router. View transitions eliminate the jarring jump between pages that makes web applications feel inferior to native apps. By capturing a snapshot of the outgoing state and cross-fading it with the incoming state, the browser creates a smooth visual continuity that preserves user context during navigation. React's implementation hooks into the concurrent rendering model, enabling transitions to be interruptible and prioritized. Shared element transitions take this further: a thumbnail on a list page morphs into a full-size hero image on the detail page, maintaining visual identity across route changes. The CSS `view-transition-name` property establishes the relationship between elements, and the browser handles the interpolation automatically. ## Use When - Navigating between routes in a React or Next.js application - Animating list-to-detail transitions with shared elements - Adding entrance/exit animations to page content - Implementing back/forward navigation with directional animations - The user requests smooth page transitions or "native-like" feel - Replacing manual FLIP animation implementations ## How It Works ```mermaid sequenceDiagram participant User participant React participant Browser participant CSS User->>React: Navigate to new route React->>Browser: startViewTransition() Browser->>Browser: Capture old state snapshot React->>React: Update DOM (concurrent) Browser->>Browser: Capture new state snapshot Browser->>CSS: Apply ::view-transition pseudo-elements CSS->>Browser: Animate old → new Browser->>User: Smooth transition rendered ``` The browser orchestrates the transition lifecycle: snapshot capture, DOM update, and cross-fade animation. React's `<ViewTransition>` component manages the timing and classification, while CSS pseudo-elements control the visual animation. ## Implementation ### Basic Route Transition ```tsx import { ViewTransition } from "react"; import { useRouter } from "next/navigation"; function PageLayout({ children }: { children: React.ReactNode }) { return ( <ViewTransition> {children} </ViewTransition> ); } ``` ### Shared Element Transition ```tsx function ProductCard({ product }: { product: Product }) { return ( <Link href={`/products/${product.id}`}> <ViewTransition name={`product-${product.id}`}> <img src={product.image} alt={product.name} /> </ViewTransition> <h3>{product.name}</h3> </Link> ); } function ProductDetail({ product }: { product: Product }) { return ( <article> <ViewTransition name={`product-${product.id}`}> <img src={product.image} alt={product.name} /> </ViewTransition> <h1>{product.name}</h1> <p>{product.description}</p> </article> ); } ``` ### Directional Navigation Animation ```tsx import { addTransitionType } from "react"; function handleNavigation(direction: "forward" | "back") { addTransitionType(direction); router.push(targetUrl); } ``` ```css ::view-transition-old(root) { animation: slide-out 200ms ease-in; } ::view-transition-new(root) { animation: slide-in 200ms ease-out; } @keyframes slide-out { to { transform: translateX(-100%); opacity: 0; } } @keyframes slide-in { from { transform: translateX(100%); opacity: 0; } } /*