View Transitions API

A native-feeling example of the View Transitions API using Pokemon cards. Click on any Pokemon to see smooth transitions between grid and detail views.

Bulbasaur

Bulbasaur

GrassPoison
Charmander

Charmander

Fire
Squirtle

Squirtle

Water
Pikachu

Pikachu

Electric
Clefairy

Clefairy

Fairy
Jigglypuff

Jigglypuff

NormalFairy
Meowth

Meowth

Normal
Abra

Abra

Psychic
Geodude

Geodude

RockGround
Gastly

Gastly

GhostPoison
Onix

Onix

RockGround
Exeggcute

Exeggcute

GrassPsychic

About View Transitions API

What is it?

The View Transitions API provides a way to create smooth transitions between different states of a page, making web apps feel more native and polished.

Key Features

  • Native-feeling transitions
  • Automatic handling of shared elements
  • Fallback support for older browsers
  • Customizable animations

How it Works

The API uses the view-transition-name CSS property to identify shared elements between states, then automatically animates them during transitions.

Browser Support

Currently supported in Chrome and other Chromium-based browsers. The API gracefully degrades in unsupported browsers.

Example Implementation

// Start a view transition
document.startViewTransition(() => {
  // Update the DOM
  setSelectedPokemon(pokemon);
});

// CSS for shared elements
.pokemon-card {
  view-transition-name: pokemon-card;
}

.pokemon-image {
  view-transition-name: pokemon-image;
}

Documentation & Resources

Official Documentation