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:
- Takes a snapshot of the old state.
- Renders the new state.
- 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
| Type | Used for | How to enable |
|---|---|---|
| Same-document | Single-page apps, tabs, filters, modals | JavaScript: document.startViewTransition() |
| Cross-document | Normal multi-page websites | CSS: @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:
- Fix speed first. Transitions feel smooth only when the next page arrives quickly. Check Core Web Vitals on your key templates.
- Add the default cross-fade with the @view-transition rule and check every page type: home, listing, detail, checkout, account.
- 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.
- Add one morphing element where it helps orientation most, usually the product image from listing to detail page.
- Add the reduced-motion rule and test it by switching on reduced motion in your operating system.
- 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 check | Where | What you hope to see |
|---|---|---|
| Pages per session on listing-to-product journeys | Analytics | Up, as browsing feels easier |
| Bounce from product pages | Analytics | Steady or down |
| INP and LCP field data | Search Console, PageSpeed Insights | No worse than before |
| User feedback | Usability sessions | Fewer "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.




