The View Transition API provides a mechanism for easily creating animated transitions between different website views. This includes animating between DOM states in a single-page app (SPA), and animating the navigation between documents in a multi-page app (MPA).
View transitions are a popular design choice for reducing users' cognitive load, helping them stay in context, and reducing perceived loading latency as they move between states or views of an application.
However, creating view transitions on the web has historically been difficult:
The View Transition API provides an easy way of handling the required view changes and transition animations for both the above use cases.
Creating a view transition that uses the browser's default transition animations is very quick to do, and there are features that allow you to both customize the transition animation and manipulate the view transition itself (for example specify circumstances under which the animation is skipped), for both SPA and MPA view transitions.
See Using the View Transition API for more information.
ViewTransitionRepresents a view transition, and provides functionality to react to the transition reaching different states (e.g., ready to run the animation, or animation finished) or skip the transition altogether.
Document.startViewTransition()Starts a new same-document (SPA) view transition and returns a ViewTransition object to represent it.
PageRevealEventThe event object for the pagereveal event. During a cross-document navigation, it allows you to manipulate the related view transition (providing access to the relevant ViewTransition object) from the document being navigated to, if a view transition was triggered by the navigation.
PageSwapEventThe event object for the pageswap event. During a cross-document navigation, it allows you to manipulate the related view transition (providing access to the relevant ViewTransition object) from the document being navigated from, if a view transition was triggered by the navigation. It also provides access to information on the navigation type and current and destination document history entries.
Window pagereveal eventFired when a document is first rendered, either when loading a fresh document from the network or activating a document (either from back/forward cache (bfcache) or prerender).
Window pageswap eventFired when a document is about to be unloaded due to a navigation.
<link rel="expect">Identifies the most critical content in the associated document for the user's initial view of the page. Document rendering will be blocked until the critical content has been parsed, ensuring a consistent first paint — and therefore, view transition — across all supporting browsers.
@view-transitionIn the case of a cross-document navigation, @view-transition is used to opt in the current and destination documents to undergo a view transition.
view-transition-nameSpecifies the view transition snapshot that selected elements will participate in, which enables an element to be animated separately from the rest of the page during a view transition.
view-transition-classProvides an additional method of styling selected elements that have a view-transition-name.
:active-view-transitionMatches elements when a view transition is in progress.
:active-view-transition-type()Matches elements when a view transition of a specific type is in progress.
::view-transitionThe root of the view transitions overlay, which contains all view transitions and sits over the top of all other page content.
::view-transition-group()The root of a single view transition.
::view-transition-image-pair()The container for a view transition's old and new views — before and after the transition.
::view-transition-old()A static snapshot of the old view, before the transition.
::view-transition-new()A live representation of the new view, after the transition.
match-element demo: An SPA featuring animated list items, demonstrating the use of the match-element value of the view-transition-name property to animate individual elements.| Specification |
|---|
| CSS View Transitions Module Level 1> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
View_Transition_API |
111 | 111 | preview140 | 97 | 18 | 111 | No | 75 | 18 | 22.0 | 111 | 18 |
callbackOptions_parameter |
125 | 125 | No | 111 | 18.2 | 125 | No | 83 | 18.2 | 27.0 | 125 | 18.2 |
updateCallback_parameter |
111 | 111 | preview140 | 97 | 18 | 111 | No | 75 | 18 | 22.0 | 111 | 18 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
View_Transition_API |
126 | 126 | No | 112 | 18.2 | 126 | No | 83 | 18.2 | 28.0 | 126 | 18.2 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API