<Transition> component to apply transitions between pages and layouts, providing smooth visual effects when navigating your application.
Page Transitions
Enable page transitions to apply automatic transitions for all your pages:If you change layouts and pages simultaneously, the page transition won’t run. Set a layout transition instead.
app.vue:
Custom Page Transitions
Set different transitions for specific pages usingdefinePageMeta:
Layout Transitions
Enable layout transitions to apply automatic transitions for all your layouts:app.vue:
Custom Layout Transitions
Apply custom layout transitions usingdefinePageMeta:
Global Settings
Customize default transition names globally usingnuxt.config. Both pageTransition and layoutTransition accept TransitionProps as JSON serializable values:
definePageMeta for individual pages:
Disable Transitions
Disable transitions for specific routes:nuxt.config:
JavaScript Hooks
Create highly dynamic transitions using JavaScript hooks, perfect for animation libraries like GSAP:Dynamic Transitions
Apply conditional transitions using inline middleware to assign different transition names:slide-left when going to a higher ID and slide-right for the previous ID.
Transition with NuxtPage
Configure transitions globally using thetransition prop on <NuxtPage />:
This page transition cannot be overridden with
definePageMeta on individual pages.View Transitions API (Experimental)
Nuxt ships with experimental support for the native View Transitions API, enabling native browser transitions between unrelated elements on different pages.Enable View Transitions
Enable the feature in your configuration:false: Disabledtrue: Enabled, respectsprefers-reduced-motion'always': Always enabled, ignores user preference
Configure Per Page
Control view transitions per page:View Transition Types
Use transition types to apply different CSS animations based on navigation type:Function values for types only work in
definePageMeta, not in nuxt.config.ts.