You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/framework/how-to/view-transitions.md
+202-3Lines changed: 202 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,205 @@ title: View Transitions
4
4
5
5
# View Transitions
6
6
7
-
<docs-warning>
8
-
This document is a work in progress. There's not much to see here (yet).
9
-
</docs-warning>
7
+
Enable smooth animations between page transitions in your React Router applications using the [View Transitions API][view-transitions-api]. This feature allows you to create seamless visual transitions during client-side navigation.
8
+
9
+
## Basic View Transition
10
+
11
+
👉 **Enable view transitions on navigation**
12
+
13
+
The simplest way to enable view transitions is by adding the `viewTransition` prop to your `Link`, `NavLink`, or `Form` components. This automatically wraps the navigation update in `document.startViewTransition()`.
14
+
15
+
```tsx
16
+
<Linkto="/about"viewTransition>
17
+
About
18
+
</Link>
19
+
```
20
+
21
+
Without any additional CSS, this provides a basic cross-fade animation between pages.
22
+
23
+
For more information on using the View Transitions API, please refer to the ["Smooth transitions with the View Transition API" guide][view-transitions-guide] from the Google Chrome team.
24
+
25
+
## Image Gallery Example
26
+
27
+
Let's build an image gallery that demonstrates how to trigger and use view transitions. We'll create a list of images that expand into a detail view with smooth animations.
0 commit comments