Native apps feel smooth because screens slide, fade and morph into each other. Websites traditionally flashed white and redrew everything, unless developers added heavy JavaScript animation libraries.

The View Transitions API changes that. With a few lines of CSS, a website can animate between pages or states smoothly, and the browser does the hard work. It's one of the clearest "native browser features over heavy JavaScript" trends in web design heading into 2027.

What view transitions do

When a page or part of a page changes, the browser:

  1. Takes a snapshot of the old state.
  2. Renders the new state.
  3. Animates between them, a cross-fade by default.

You can customise the animation and pick elements that should morph from one position to another, like a product thumbnail growing into the main product image.

Two types

TypeUsed forHow to enable
Same-documentSingle-page apps, tabs, filters, modalsJavaScript: document.startViewTransition()
Cross-documentNormal multi-page websitesCSS: @view-transition rule on both pages

The simplest possible example (multi-page site)

Add this CSS to every page on the same site:

@view-transition {
  navigation: auto;
}

Now navigating between pages on your site cross-fades instead of flashing. Browsers that don't support it simply navigate normally.

Morphing an element between pages

Give the same element a matching name on both pages:

/* On the product listing page */
.product-card img { view-transition-name: product-photo; }

/* On the product page */
.product-hero img { view-transition-name: product-photo; }

The browser animates the image from its position in the grid to its position at the top of the product page. Each name must be unique on a page, so in a grid you'd set the name only on the clicked item.

Customising the animation

::view-transition-old(root) {
  animation: 200ms ease-out both fade-out;
}
::view-transition-new(root) {
  animation: 300ms ease-in both fade-in;
}

Keep transitions short: roughly 150–350 ms feels responsive. Longer animations make the site feel slow, which defeats the point.

Respect reduced motion

Some people get dizzy or distracted by motion. Always honour their system setting:

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

This is part of good accessibility. See our WCAG 2.2 checklist.

In frameworks

  • React 19.2 introduced a ViewTransition component, and Next.js 16 uses it. Read Next.js 16 for business owners.
  • Astro has built-in view transition support.
  • Other frameworks offer helpers or work with the native API directly.

Where view transitions help users

  • E-commerce: product thumbnail to product page, keeping shoppers oriented.
  • Filters and sorting: results rearranging smoothly instead of jumping.
  • Tabs and steps: multi-step forms and onboarding flows. See onboarding UX.
  • Galleries and portfolios.
  • Dark mode toggles: a smooth change instead of a flash. See dark mode design.

Where to hold back

  • Every single interaction. Motion should guide attention, not decorate everything.
  • Slow pages. A transition can't hide a page that takes three seconds to load. Fix speed first. Read INP explained.
  • Long or bouncy animations on business sites, which feel gimmicky.

Performance tips

  • Animate opacity and transform (the defaults do).
  • Avoid naming dozens of elements for transitions on one page.
  • Test on a mid-range Android phone, not just a fast laptop.
  • Combine with prerendering (the Speculation Rules API) for near-instant page loads on supporting browsers.

Rolling it out on an existing site

You don't need a rebuild. A safe order:

  1. Fix speed first. Transitions feel smooth only when the next page arrives quickly. Check Core Web Vitals on your key templates.
  2. Add the default cross-fade with the @view-transition rule and check every page type: home, listing, detail, checkout, account.
  3. Exclude anything that shouldn't animate, such as checkout steps where a fade could look like a glitch, by leaving the rule off those pages.
  4. Add one morphing element where it helps orientation most, usually the product image from listing to detail page.
  5. Add the reduced-motion rule and test it by switching on reduced motion in your operating system.
  6. Test on real devices: a mid-range Android phone, an iPhone and a desktop browser that doesn't support cross-document transitions, to confirm navigation still works normally.

How to tell if it's helping

What to checkWhereWhat you hope to see
Pages per session on listing-to-product journeysAnalyticsUp, as browsing feels easier
Bounce from product pagesAnalyticsSteady or down
INP and LCP field dataSearch Console, PageSpeed InsightsNo worse than before
User feedbackUsability sessionsFewer "where am I?" moments

If performance metrics get worse, shorten or remove the custom animations before blaming the API: the default cross-fade is very light.

Common problems

  • Two elements with the same view-transition-name on one page, which stops the transition. Give names only to the specific item being animated.
  • Images stretching during the morph because their aspect ratios differ between pages. Match the ratio, or use object-fit consistently.
  • Sticky headers jumping. Give the header its own view-transition-name so it stays put while content changes.
  • Animations running when the user reloads the page. Cross-document transitions only run on same-origin navigations, so this usually points to custom JavaScript doing extra work.

The short version

The View Transitions API lets websites animate smoothly between pages and states with a little CSS, handled efficiently by the browser. Enable cross-document transitions with @view-transition, morph key elements with matching view-transition-name values, keep animations short, honour reduced-motion settings and use motion to guide users rather than decorate.

Want a website that feels as smooth as an app? Our web development team and UI/UX design team build fast, polished sites.