September 10, 2025

Modern websites feel more engaging when page transitions are smooth instead of instantly switching from one page to another. That’s exactly what the View Transitions API offers, and with the
next-view-transitionsThe View Transitions API is a browser feature that allows smooth, animated transitions between different pages or states. Instead of instantly replacing content, it makes your app feel like a native mobile app by animating changes.
👉 Example:
This library is great for basic use cases with the Next.js App Router. However, for advanced use cases like concurrent rendering, Suspense, or streaming, React and Next.js are still developing new primitives and APIs.
First, install the package with your favorite package manager:
pnpm install next-view-transitions
Or with npm/yarn:
npm install next-view-transitions
# or
yarn add next-view-transitions
Wrap your app with
<ViewTransitions>import { ViewTransitions } from 'next-view-transitions'
export default function Layout({ children }) {
return (
<ViewTransitions>
<html lang="en">
<body>
{children}
</body>
</html>
</ViewTransitions>
)
}
Use the Link component to automatically apply view transitions on navigation.
import { Link } from 'next-view-transitions'
export default function Component() {
return (
<div>
<Link href="/about">Go to /about</Link>
</div>
)
}
useTransitionRouter()For programmatic navigation, use the
useTransitionRouter()import { useTransitionRouter } from 'next-view-transitions'
export default function Component() {
const router = useTransitionRouter()
return (
<div>
<button onClick={() => router.push('/about')}>
Go to /about
</button>
</div>
)
}
With just a few lines of code, you’ve added smooth page transitions to your Next.js app. No more hard cuts between routes—your site now feels polished and delightful.
The Next.js View Transitions package is a simple but powerful tool to improve the user experience in your Next.js App Router projects. While it’s still evolving and doesn’t yet cover every complex use case, it’s an easy win for making your app feel modern and smooth.