useViewTransition
Returns the view transition in flight, if any.
ts
import { useViewTransition } from '@kitbag/router'
const viewTransition = useViewTransition()
onMounted(async () => {
await viewTransition.transition?.finished
heading.value?.focus()
})The returned object is reactive, so read its properties where they are used rather than destructuring them.
| Property | Description |
|---|---|
| isTransitioning | True from when a navigation is decided to transition until its animation finishes |
| to | The route being navigated to |
| from | The route being left |
| types | The types the transition runs with |
| transition | The browser's ViewTransition, once started |
TIP
Register your router to get the proper types for to and from when using this composable.