Skip to main content

View Transitions

Learn how to use the View Transitions API with React Router for smooth page transitions.

Overview

The View Transitions API allows you to create smooth, animated transitions between different states of your application. React Router integrates with this API to provide seamless page transitions.

Browser Support

The View Transitions API is supported in:
  • Chrome/Edge 111+
  • Safari 18+
  • Firefox (experimental)
React Router gracefully degrades in browsers without support.

Enabling View Transitions

Enable view transitions on navigation:

Programmatic Navigation

Use view transitions with navigate:

Form Submissions

Animate form submission transitions:

Custom Animations

Define custom transition animations with CSS:

Named Transitions

Animate specific elements independently:
Style named transitions:

Conditional Transitions

Apply transitions based on conditions:
Prevent transitions for skip links:

Animation Direction

Change animation based on navigation direction:
CSS for directional animations:

Loading States

Animate loading states during transitions:

Reduced Motion

Respect user’s motion preferences:

JavaScript Control

Access the transition object for advanced control:

Best Practices

  1. Keep animations short - 200-400ms for most transitions
  2. Use meaningful animations - Match the user’s mental model
  3. Respect reduced motion - Honor prefers-reduced-motion
  4. Test performance - Ensure smooth 60fps animations
  5. Provide fallbacks - Work in browsers without View Transitions support
  6. Use named transitions sparingly - Only for key elements
  7. Consider mobile - Simpler animations work better on slower devices
  8. Test across browsers - Support varies across browsers