Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/vtbag/website. The @vtbag website. ⭐️ Please star to support this work! ⭐️
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495---title: The View Transition APIdescription: Basics information about the View Transition browser APIhead: - tag: meta attrs: property: "og:image" content: "/api-og.png"---
The View Transition API is a rather new browser API. It gives you three cool things:- [Pseudo-elements](/basics/pseudos/) that let you simultaneously show elements from the old and from the new DOM.- Automatically generated cross-fade and morph [animations](/basics/default-animations/) that let you animate between the old and new images.- [Continuous synchronization](/basics/default-animations/#view-transition-super-power) of content and some styles from the captured elements of the new DOM to their pseudo-elements, so that dynamic content changes become visible at once, and morph animations react to updates of the new elements' position in real time.
There are two ways to trigger a view transition: - You can call [`startViewTransition()`](/basics/javascript/#startviewtransition) on the document or an element for global respectively scoped, same-document view transitions.- You can enable cross-document view transitions with the `@view-transition` CSS at-rule.
In this section you can find…
* …some [basic examples](/basics/examples/) of same-document and cross document view transitions.* …information about the [structure of the pseudo-elements](/basics/pseudos/) of the API.* …and about the [mechanisms of the default animations](/basics/default-animations/).* …some background on [how to style view transitions](/basics/styling/).* …details on how to use the [JavaScript API](/basics/javascript/) for same-document view transitions.* …all there is to know about the [stacking behavior](/basics/hide-and-seek/) of view transitions.
While I add more pages, I'm also happy that I can offer some links to previous work on the [`astro-vtbot` package](https://www.npmjs.com/package/astro-vtbot), especially an in depth [same-document example](https://events-3bg.pages.dev/jotter/api/example/)
## References
Looking for more information about the View Transition API? Here are some references:
### W3C Drafts (Preliminary Specs)
* **Level 2**: *CSS View Transitions Module Level 2* (Editor's Draft)\[https://drafts.csswg.org/css-view-transitions-2/](https://drafts.csswg.org/css-view-transitions-2/) _(now also includes the Level 1 document)_
* **Level 1**: *CSS View Transitions Module Level 1* (Editor's Draft)\[https://drafts.csswg.org/css-view-transitions-1/](https://drafts.csswg.org/css-view-transitions-1/) _(now also part of the Level 2 document)_
#### Recent ChangesTest whether your browser supports the latest features of the View Transition API on [this test page](/basics/test-page/).
|When|What|Where||---|---|---||2026-06-29|You cannot use `none` or identifiers starting with `-ua-` as names for view transition types. If you try to add those to the view transition's types set, they will simply be ignored. The latter is consistent with the restriction that view transition names starting with `-ua-` are reserved for use by the browser (the user agent).|[View Transition Types](https://drafts.csswg.org/css-view-transitions-2/#types-cross-doc)||2026-04-29|Duplicate view transition names will be ignored instead of causing the view transition to fail. Originally, if the same view transition name was found twice during a capturing phase, the view transition was skipped. The new behaviour will automatically remove view transition names with non-unique definitions and continue the view transition with the remaining unique names. (_Not yet supported by any browser_) |[View Transition Activation](https://drafts.csswg.org/css-view-transitions-2/#activate-view-transition)||2026-03-09|`view-transition-scope: auto` (_outdated_) was superseded by [`view-transition-scope: all`](/basics/javascript/#view-transition-scope). You can use this property to hide view transition names inside a DOM subtree from view transitions started outside of it.|[view-transition-scope](https://drafts.csswg.org/css-view-transitions-2/#view-transition-scope-prop)|2026-01-26|`contain: view-transition` (_outdated_) was superseded by `view-transition-scope: auto`. (_outdated_) |[view-transition-scope](https://drafts.csswg.org/css-view-transitions-2/#view-transition-scope-prop)||Level 1 of the spec was merged into Level 2. Level 1 is only for historical reference. Development of the API now happens solely in the Level 2 document.|| |2025-10-17|The view transition object offers a [`waitUntil()`](/basics/javascript/#waituntil) function that can be called with a promise. Now the view transitions `finished` promise does not only wait for the animations on pseudo-elements to end, but also waits for all promises passed via `waitUntil()` to settle.|[Level 2, waitUntil](https://drafts.csswg.org/css-view-transitions-2/#dom-viewtransition-waituntil)| |2025-10-02|[Scoped view transitions](/basics/javascript/#scoped-view-transitions), where `startViewTransition()` can be called on DOM elements. To distinguish (element-)scoped view transitions from what we had before, cross-document view transitions and view transitions started with `document.startViewTransition()` might also be called _global_ view transitions.|[Level 2, Scoped View Transitions](https://drafts.csswg.org/css-view-transitions-2/#scoped-vt)|2025-10-02| The [`transitionRoot`](/basics/javascript/#transitionroot) property of the view transition object returns the root element of a scoped view transition. For a global view transition it returns the `documentElement`.|[Level 2, transitionRoot](https://drafts.csswg.org/css-view-transitions-2/#dom-viewtransition-transitionroot)||2025-10-02|A new value `view-transition` (_outdated_) for the `contain` property was introduced. In March 2026, it was superseded by [`view-transition-scope: all`](/basics/javascript/#view-transition-scope), which ensures that view transition names are not visible outside a subtree.|[Level 2, View Transition Name Isolation](https://drafts.csswg.org/css-view-transitions-2/#view-transition-scope-prop)||2025-08-25|Expose the currently active view transition object as [`activeViewTransition`](/basics/javascript/#checking-for-an-active-view-transition) on the document, or on an element for scoped view transitions.| [Level 2, Exposing current transition](https://drafts.csswg.org/css-view-transitions-2/#active-view-transition) | |2025-06-18| The `old`, `new`, and `image-pair` pseudos now also [inherit](/basics/styling/#inherited-animation-properties) the timing function, iteration count, direction, play state animation properties.|[Level 1, User Agent Styles](https://drafts.csswg.org/css-view-transitions-1/#ua-styles)|2025-06-16| Nested view transition groups are children of a new pseudo-element, which is the sibling of the image pair. The border width of this [`::view-transition-group-children()`](/basics/pseudos/#nested-view-transition-groups) pseudo-element gets automatically copied over from the original element.|[Level 2, Group Children](https://drafts.csswg.org/css-view-transitions-2/#view-transition-group-children-pseudo)||2025-03-24| Change to [`view-transition-name: auto`](/basics/pseudos/#auto-generated-names-auto) when the element has an id property: Instead of using the id as view transition name, now generates a random name like match-element. |[Level 2, View Transition Name](https://drafts.csswg.org/css-view-transitions-2/#additions-to-vt-name) ||2025-02-20| Added [`view-transition-name: match-element;`](/basics/pseudos/#auto-generated-names-match-element) for automatically assigning element specific view transition names.|[Level 2, View Transition Name](https://drafts.csswg.org/css-view-transitions-2/#additions-to-vt-name)|
#### Upcoming Topics
These may or may not make it into the spec.
|When|What|Where||---|---|---||2025-09-18|Support two phases for cross-document view transitions: instead of waiting for enough content of the new page to load before starting animations, begin them on the old page by hopping through a quickly computable preview state for a smoother user experience. |[Explainer: Two-phase view transition](https://github.com/w3c/csswg-drafts/blob/main/css-view-transitions-2/two-phase-transition-explainer.md)|2025-08-20|Allow the view transition pseudo-elements inside the :has() pseudo-class.|[#12630](https://github.com/w3c/csswg-drafts/issues/12630)| |2025-08-05|Introduce DOM nodes as proxies to pseudo-elements. This would for example allow us to define an event listener for `::view-transition-new(button)` using such a proxy.|[#12575](https://github.com/w3c/csswg-drafts/issues/12575)||2025-06-18| Also copy border radius and corner shape form old and new original elements and animate the `::view-transition-group-children()` from old to new values.|[#12357](https://github.com/w3c/csswg-drafts/issues/12357), [#12363](https://github.com/w3c/csswg-drafts/issues/12363) ||2025-05-28|User defined view transition names must not start with `-ua-` as those are reserved for the user agent, e.g. for `match-element` and `auto`.|[#12241](https://github.com/w3c/csswg-drafts/issues/12241) ||2025-01-29| `::view-transition-new(*) { pointer-events: auto }` to forward pointer events from the pseudo-element to the original element.|[#11596](https://github.com/w3c/csswg-drafts/issues/11596) |
### MDN* The Documentation of the View Transition API on MDN [https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
### Explainers* The Level 1 View Transition API *Explainer* at W3C/WICG: [https://github.com/WICG/view-transitions/blob/main/explainer.md](https://github.com/WICG/view-transitions/blob/main/explainer.md)* The Level 2 View Transition API *Explainer* at W3C/WICG: [https://github.com/WICG/view-transitions/blob/main/cross-doc-explainer.md#pageconceal](https://github.com/WICG/view-transitions/blob/main/cross-doc-explainer.md#pageconceal)
### Must Reads
Highly recommended introductions by examples and deep dives:
* Jake Archibald's *Same-document view transitions for single-page applications* [https://developer.chrome.com/docs/web-platform/view-transitions/same-document](https://developer.chrome.com/docs/web-platform/view-transitions/same-document)
* Bramus' *Cross-document view transitions for multi-page applications* [https://developer.chrome.com/docs/web-platform/view-transitions/cross-document](https://developer.chrome.com/docs/web-platform/view-transitions/cross-document)
* Jake's eye-opening article on [how to handle aspect ratio](https://jakearchibald.com/2024/view-transitions-handling-aspect-ratio-changes/)
* A collection of [same-page and cross-page examples](https://view-transitions.chrome.dev/) from Bramus.