Skip to content

Commit ef9179a

Browse files
Update view-transitions.mdx (#10951)
Co-authored-by: Sarah Rainsberger <[email protected]>
1 parent cd542d7 commit ef9179a

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/content/docs/en/guides/view-transitions.mdx

+11-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ i18nReady: true
88
import Since from '~/components/Since.astro'
99
import { Steps } from '@astrojs/starlight/components'
1010

11-
Astro supports **opt-in, per-page, view transitions** with just a few lines of code. View transitions update your page content without the browser's normal, full-page navigation refresh and provide seamless animations between pages.
11+
Astro supports view transitions with just a few lines of code. View transitions update your page content without the browsers normal, full-page navigation refresh and provide seamless animations between pages. Where [browser support for the View Transition API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API#browser_compatibility) is lacking, Astro allows you to [control fallback strategies](#fallback-control) for the best possible experience for all visitors.
1212

1313
Astro provides a `<ClientRouter />` routing component that can be added to a single page's `<head>` to control page transitions as you navigate away to another page. It provides a lightweight client-side router that [intercepts navigation](#client-side-navigation-process) and allows you to customize the transition between pages.
1414

@@ -23,7 +23,6 @@ Astro's view transitions support is powered by the new [View Transitions](https:
2323
- [Control over fallback behavior](#fallback-control) for browsers that do not yet support the View Transition APIs.
2424
- Automatic support for [`prefers-reduced-motion`](#prefers-reduced-motion).
2525

26-
2726
:::note
2827
By default, every page will use regular, full-page, browser navigation. You must opt in to view transitions and can use them either on a per-page basis or site-wide.
2928
:::
@@ -445,7 +444,16 @@ You can opt out of router transitions on any individual form using the `data-ast
445444

446445
## Fallback control
447446

448-
The `<ClientRouter />` router works best in browsers that support View Transitions (i.e. Chromium browsers), but also includes default fallback support for other browsers. Even if the browser does not support the View Transitions API, Astro will still provide in-browser navigation using one of the fallback options for a comparable experience.
447+
The `<ClientRouter />` router works best in browsers that support View Transitions (i.e. Chromium browsers), but also includes default fallback support for other browsers. Even if the browser does not support the View Transitions API, Astro's client router can still provide in-browser navigation using one of the fallback options.
448+
449+
Depending on browser support, you may need to explicitly set the `name` or `animate` [`transition` directives](#transition-directives) on the elements you wish to animate for a comparable experience across all browsers:
450+
451+
```astro title="src/pages/about.astro"
452+
---
453+
import Layout from '../layouts/LayoutUsingClientRouter.astro'
454+
---
455+
<title transition:animate="fade">About my site</title>
456+
```
449457

450458
You can override Astro's default fallback support by adding a `fallback` property on the `<ClientRouter />` component and setting it to `swap` or `none`:
451459

0 commit comments

Comments
 (0)