CSS View Transitions API: Smooth Page Transitions

CSS View Transitions API: Smooth Page Transitions

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1419
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1287
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    983
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1246
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    983
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    998

CSS View Transitions API: Smooth Page Transitions

Abrupt page transitions in MPA or SPA are a common reason for user churn. According to case studies, smooth animations can increase engagement by 20% and reduce bounce rate by 15%. We implement the View Transitions API to eliminate jank without third-party libraries. The browser captures a screenshot of the old state, applies the new state, and animates the change. The result is smooth crossfade or custom animation in a few lines of CSS. On average, this approach is twice as fast as JavaScript alternatives because all work is done on the GPU. Improving Core Web Vitals is a key goal. View Transitions API positively affects INP (Interaction to Next Paint) since animations run on the GPU without blocking the main thread. This is especially important for high-performance sites like e-commerce stores and news portals. Savings on animation development reach 30% compared to using libraries.

This native mechanism provides a simple API for smooth DOM state transitions without additional development and maintenance costs.

How the View Transitions API Solves the Problem of Abrupt Transitions

The API works via document.startViewTransition. The callback is a function that updates the DOM. The browser captures the old state, applies the new one, then animates the transition using pseudo-elements ::view-transition-old and ::view-transition-new. By default, it's a crossfade (0.2s). We customize duration, timing, and direction to fit the project's needs. For example, for an e-commerce site with a product catalog, we use slides to mimic page turning. This improves navigation perception and reduces cognitive load. Average LCP improvement is 25% after implementation.

Basic Usage (SPA) – CSS View Transitions

// utils/view-transition.ts export async function navigateWithTransition( updateDOM: () => void | Promise<void> ): Promise<void> { if (!document.startViewTransition) { await updateDOM(); return; } const transition = document.startViewTransition(async () => { await updateDOM(); }); try { await transition.finished; } catch (e) { if (!(e instanceof DOMException && e.name === 'AbortError')) throw e; } } 

Integration with React Router v6

// router/transition-router.tsx import { useNavigate } from 'react-router-dom'; import { navigateWithTransition } from '../utils/view-transition'; export function useTransitionNavigate() { const navigate = useNavigate(); return (to: string, options?: { replace?: boolean }) => { navigateWithTransition(() => navigate(to, options)); }; } 

Next.js App Router

Next.js 14+ supports this technology via unstable_viewTransition on next/link:

// components/TransitionLink.tsx 'use client'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; export function TransitionLink({ href, children, className }: { href: string; children: React.ReactNode; className?: string }) { const router = useRouter(); const handleClick = (e: React.MouseEvent) => { e.preventDefault(); if (!document.startViewTransition) { router.push(href); return; } document.startViewTransition(() => router.push(href)); }; return <a href={href} onClick={handleClick} className={className}>{children}</a>; } 

Why Use Named Transitions?

Named transitions (the view-transition-name property) allow smooth 'transport' of an element between pages. For example, a product card on a list and its enlarged version on the detail page — the browser animates scaling and position automatically. This provides a shared element transition effect familiar from mobile apps. We set unique names for dynamic lists via CSS or inline styles. This approach improves visual integrity of the interface and makes navigation more intuitive. Currently, 80% of users have browsers that support the API, according to caniuse statistics.

CSS: Custom Animations

/* styles/view-transitions.css */ ::view-transition-old(root) { animation: fade-out 0.2s ease-out; } ::view-transition-new(root) { animation: fade-in 0.3s ease-out; } @keyframes fade-out { to { opacity: 0; } } @keyframes fade-in { from { opacity: 0; } } /* Slide for navigation */ @keyframes slide-from-right { from { transform: translateX(40px); opacity: 0; } } @keyframes slide-to-left { to { transform: translateX(-40px); opacity: 0; } } html[data-transition="forward"] { &::view-transition-old(root) { animation: slide-to-left 0.25s ease-in both; } &::view-transition-new(root) { animation: slide-from-right 0.25s ease-out both; } } html[data-transition="backward"] { &::view-transition-old(root) { animation: 0.25s ease-in both reverse slide-from-right; } &::view-transition-new(root) { animation: 0.25s ease-out both reverse slide-to-left; } } 

What Our Service Includes

  • UX audit: Identify pages with abrupt transitions, analyze Core Web Vitals metrics.
  • Animation design: Crossfade, slides, named transitions tailored to the site style. Choose the optimal type for each route.
  • Implementation with prefers-reduced-motion support for accessibility. Ensure animations do not cause discomfort.
  • Testing in Chrome, Safari, Edge, and Firefox (with flag). Test on real devices and emulators.
  • Documentation for maintenance and developer instructions. Includes descriptions of all custom animations and fallbacks.
Animation Type Performance Implementation Complexity Usage
Crossfade High Low Base transitions
Slide High Medium Forward/backward navigation
Named Medium High Shared element transitions

Our team has over 5 years of frontend development experience and has implemented 30+ projects with custom animations. We guarantee smooth transitions with no jank.

Comparison: View Transitions API vs Animation Libraries

Criterion View Transitions API Framer Motion / GSAP
Performance Native, no CPU load Depends on complexity
Bundle size 0 KB 10–50 KB+
Browser support Chrome 111+, Safari 18+ All modern
Customization Via CSS JavaScript
Named transitions Built-in Requires code

This API wins in performance and size but lags in old browser support. For projects with a modern audience, it's the optimal choice. On average, native API animations are 30% faster than those using JS libraries.

Process

  1. Analysis: Determine routes that need transitions.
  2. Design: Create animation prototypes in Figma/CodeSandbox.
  3. Implementation: Integrate View Transitions with custom CSS.
  4. Testing: Check on real devices and emulators.
  5. Deployment: Add fallback for unsupported browsers.
Example fallback for old browsers
if (!document.startViewTransition) { document.body.classList.add('no-transition'); } 

In CSS for .no-transition, disable all view-transition rules.

Timeline: basic setup takes from 4 hours; comprehensive solution takes 3–4 working days. Cost is calculated individually after assessing the scope.

Evaluate your project for free — contact us. Get a consultation on implementing smooth transitions without unnecessary costs. Order View Transitions API integration into your project right now.