View Transitions API — native JS API for smooth animations between DOM states. document.startViewTransition() snapshots the old state → applies changes → animates the transition via CSS. Chrome 111+ (same-document), 126+ (cross-document). Framework-agnostic, with React Router and Next.js integrations already available.
Below: details, example, related terms, FAQ.
Free online tool — HTTP header checker: instant results, no signup.
// Plain JS — SPA page switch
function navigate(url) {
if (!document.startViewTransition) return render(url);
document.startViewTransition(() => render(url));
}
// CSS custom animation
@keyframes fade-in { from { opacity: 0; } }
::view-transition-new(root) {
animation: fade-in 0.3s ease;
}The View Transitions API provides a straightforward way to implement smooth page transitions in your web application. To get started, ensure you are using a supported browser version (Chrome 111+ for same-document transitions and 126+ for cross-document transitions).
Here’s a step-by-step guide to implement the View Transitions API:
if (!document.startViewTransition) { console.warn('View Transitions API not supported.'); }document.startViewTransition(). Here’s an example:document.startViewTransition(() => {
// Update your DOM here
document.getElementById('content').innerText = 'New Content';
});transition: opacity 0.5s ease-in-out;With these steps, you can implement the View Transitions API effectively in your web application, providing users with smooth and visually appealing transitions between different states.
The View Transitions API is versatile and can be utilized in various scenarios to enhance user experience. Below are some common use cases:
By leveraging the View Transitions API, developers can create richer, more interactive web applications that keep users engaged and satisfied.
The View Transitions API is designed to be framework-agnostic, meaning it can be integrated into various web frameworks seamlessly. Below, we discuss how to integrate it with popular frameworks like React and Next.js.
To use the View Transitions API in a React application, you can create a custom hook or utilize it directly within a component. Here’s a simple example:
const useViewTransition = (updateContent) => {
const startTransition = () => {
document.startViewTransition(() => {
updateContent();
});
};
return startTransition;
};Then, you can call this hook when you want to transition:
const handleClick = useViewTransition(() => { setContent('New Content'); });For Next.js, you can wrap your page transitions in the document.startViewTransition() call during routing. You can achieve this by using the useEffect hook to listen for route changes:
useEffect(() => {
const handleRouteChange = () => {
document.startViewTransition(() => {
// Trigger Next.js routing
router.push('/new-page');
});
};
router.events.on('routeChangeStart', handleRouteChange);
return () => {
router.events.off('routeChangeStart', handleRouteChange);
};
}, []);By following these examples, you can effectively integrate the View Transitions API into your React or Next.js applications, enhancing user experience with smooth transitions.
For simple page transitions — yes. For complex interactive animations (drag, spring physics) — Framer Motion / GSAP are better.
Technology Preview 208 (2025) has same-document. Production Safari — not yet. Firefox — also WIP.
Same-document: no impact (SPA routing). Cross-document: native navigation, crawlers see regular navigation.
Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.