What are view transitions?
also known asview transitions API · shared element transitions · morph navigation
View transitions are a browser feature that animates between two page states, so a thumbnail can smoothly grow into a full image on the next screen.
view-transition-name: hero::view-transition-old(root)@view-transition { navigation: auto }Click a product photo in a shop and the next page simply appears. The photo you pressed vanishes, a bigger one pops in somewhere else, and your brain has to work out that they are the same thing. Native apps have faked this continuity for years with a grow-and-settle animation. View transitions finally bring it to the browser as a built-in feature.
The mechanism is neat. When you call document.startViewTransition(), the browser takes a snapshot of the current page, lets you update the DOM, takes a snapshot of the new state, and then animates between the two images. By default you get a gentle cross-fade, which already feels better than a hard cut. The real magic appears when you tag elements with a view-transition-name. Elements that share a name in the old and new states are matched, and the browser morphs one into the other, adjusting position, size and shape along the way.
Under the hood the browser builds a tree of pseudo-elements, such as ::view-transition-old() and ::view-transition-new(), which you can style with ordinary CSS animations. That means you can slow the cross-fade, make the new page slide in from the right, or leave the default alone. Before this existed, shared element animations needed JavaScript techniques such as FLIP or framework layout animation libraries. Now the browser does the measuring.
There are two flavours. Same-document transitions run inside a single page, which suits single-page apps, tab changes, filter updates and opening a modal. Cross-document transitions work between separate page loads in an ordinary multi-page site, opted into with a small CSS rule such as @view-transition { navigation: auto }. That second flavour is a big deal, because it brings app-like motion to plain HTML sites without a framework. Browser support is good for the same-document type across the major engines, and the cross-document type has been rolling out more slowly, so check current support tables before depending on it.
It also changes who can build this kind of motion. A small studio with a plain HTML site can now ship the sort of page-to-page continuity that once demanded a JavaScript framework and a dedicated animation engineer. The browser handles snapshots, interruptions and cleanup, and you describe only what should look different.
The feature is best used for continuity, not decoration. A card that grows into its detail page tells the user where they are going. A list item sliding to a new position tells them what changed. A logo spinning in for no reason tells them nothing, and costs time.
A few guidelines:
- Give each shared element a unique view-transition-name on the page. Duplicates break the transition.
- Keep animations short, around 200 to 350 milliseconds, so navigation does not feel slower.
- Choose one or two anchors per route, like the hero image and the title, and let the rest cross-fade.
- Treat it as progressive enhancement. Browsers without support just update instantly, which is acceptable.
- Respect prefers-reduced-motion by shortening or disabling the animation.
- Be careful with very heavy pages, since the snapshots add work.
For AI prompts, name the shared elements and the effect. Ask for a card list where the thumbnail has a view-transition-name matching the detail page hero, a 300ms ease-out morph, a simple cross-fade for everything else and a reduced-motion fallback. Without that, a model tends to add a JavaScript animation library you do not need.
- Card → detail-page navigations (product, blog, portfolio)
- Tab switches and filter changes within a page
- Modal open/close where the trigger should morph into the modal
- Pages with completely unrelated layouts before/after, no morph reads as natural
- Critical-path flows where users navigate fast (the transition adds latency)
- +Tag matching elements with the same `view-transition-name`
- +Keep transitions under 350ms, longer feels sluggish
- +Provide a fallback (instant cut) for browsers without support
- −Don't transition every element, pick 1–2 anchors per route
- −Don't combine with heavy parallax during the transition
View Transitions: your questions, answered
What are view transitions in web design?
View transitions are a native browser feature that animates between two states of a page. The browser captures the old and new views and fades or morphs between them. Elements sharing a view-transition-name can move and resize smoothly, such as a thumbnail growing into a hero image.
How do you use the View Transitions API?
Wrap your DOM update in document.startViewTransition() for same-document changes, and give matching elements the same view-transition-name in CSS. For multi-page sites, opt in with @view-transition { navigation: auto }. You can then style the ::view-transition pseudo-elements to change timing and motion.
Which browsers support view transitions?
Same-document view transitions are available across the major modern browsers. Cross-document transitions arrived in Chromium-based browsers first and have been rolling out elsewhere. Always check a current support table and treat the feature as a progressive enhancement that falls back to an instant switch.
Do view transitions replace Framer Motion or GSAP?
Only for some jobs. They cover page-level and shared-element transitions neatly. Complex, interruptible, gesture-driven or physics-based animation still benefits from a dedicated library. Many projects use view transitions for navigation and a library for finer interactions inside components.
Do view transitions hurt performance or accessibility?
Short transitions are cheap, though snapshots on very heavy pages add work. For accessibility, respect prefers-reduced-motion by shortening or removing animation, and make sure focus lands sensibly on the new view. Content should never depend on the animation to make sense.
More quick answers
What is a view-transition-name?
It is a CSS property that gives an element a label. Elements with the same label in the old and new states are treated as one object and morphed between them.
Do view transitions work with React or Next.js?
Yes. You can call startViewTransition around state updates, and several frameworks and routers have added helpers for it. Plan for a fallback in browsers without support.
How long should a view transition last?
Between 200 and 350 milliseconds suits most navigation. Longer animations quickly start to feel like waiting, especially on actions people repeat dozens of times a day.
View transitions vs scroll reveal: what is the difference?
View transitions animate between two states of a page when something changes, such as a navigation. Scroll reveal animates elements into view as you scroll down a page.
Can view transitions animate a horizontal scroll section?
Not directly. View transitions handle changes between states, whereas a pinned horizontal track is driven continuously by scroll progress, so scroll-driven animation fits better.
Found this useful? A GitHub star helps other designers find it.