--- navigation.icon: uil:moon-eclipse description: Nuxt leverages Vue's Transition component to apply transitions between pages and layouts. --- # Transitions Nuxt leverages Vue's [``](https://vuejs.org/guide/built-ins/transition.html#the-transition-component) component to apply transitions between pages and layouts. ## Page transitions Nuxt sets `{ name: 'page', mode: 'out-in' }` transition by default for all your [pages](/guide/directory-structure/pages). To start adding transition between your pages, add the following CSS to your [`app.vue`](/guide/directory-structure/app): ::code-group ```html [app.vue] ``` ```html [pages/index.vue] ``` ```html [pages/about.vue] ``` :: This produces the following result when navigating between pages: To set a different transition for a page, set the `pageTransition` key in [`definePageMeta`](/api/utils/define-page-meta) of the page: ::code-group ```vue [pages/about.vue] ``` ```html [app.vue] ``` :: Moving to the about page will add the 3d rotation effect: ## Layouts transitions Nuxt sets `{ name: 'layout', mode: 'out-in' }` transition by default for all your [layouts](/guide/directory-structure/layouts). To start adding transition between your pages, add the following CSS to your [`app.vue`](/guide/directory-structure/app): ::code-group ```html [app.vue] ``` ```html [layouts/default.vue] ``` ```html [layouts/orange.vue] ``` ```html [pages/index.vue] ``` ```html [pages/about.vue] ``` :: This produces the following result when navigating between pages: Similar to `pageTransition`, you can apply a custom `layoutTransition` to the page component using `definePageMeta`: ```vue [pages/about.vue] ``` ## Global settings You can customize these default transition names globally using `nuxt.config`. Both `pageTransition` and `layoutTransition` keys accept [`TransitionProps`](https://vuejs.org/api/built-in-components.html#transition) as JSON serializable values where you can pass the `name`, `mode` and other valid transition-props of the custom CSS transition. ```ts [nuxt.config.ts] export default defineNuxtConfig({ pageTransition: { name: 'fade', mode: 'out-in' // default }, layoutTransition: { name: 'slide', mode: 'out-in' // default } }) ``` ::alert{type="info"} If you change the `name` property, you also have to rename the CSS classes accordingly. :: To override the global transition property, use the `definePageMeta` to define page or layout transitions for a single Nuxt page and override any page or layout transitions that are defined globally in `nuxt.config` file. ```vue [pages/some-page.vue] ``` ## Disable Transitions `pageTransition` and `layoutTransition` can be disabled for a specific route: ```vue [pages/some-page.vue] ``` Or globally in the `nuxt.config`: ```ts [nuxt.config.ts] defineNuxtConfig({ pageTransition: false, layoutTransition: false }) ``` ## JavaScript Hooks For advanced use-cases, you can use JavaScript hooks to create highly dynamic and custom transitions for your Nuxt pages. This way presents perfect use-cases for JavaScript animation libraries such as [GSAP](https://greensock.com/gsap/) or [Tween.js](https://createjs.com/tweenjs). ```vue [pages/some-page.vue] ``` ::alert{type="info"} Learn more about additional [JavaScript hooks](https://vuejs.org/guide/built-ins/transition.html#javascript-hooks) available in the `Transition` component. :: ## Dynamic Transitions To apply dynamic transitions using conditional logic, you can leverage inline [middleware](/guide/directory-structure/middleware) to assign a different transition name to `to.meta.pageTransition`. ::code-group ```html [pages/[id].vue] ``` ```html [layouts/default.vue] ``` :: The page now applies the `slide-left` transition when going to the next id and `slide-right` for the previous: ## Transition with NuxtPage When `` is used in `app.vue`, transition-props can be passed directly as a component props to activate global transition. ```vue [app.vue] ``` ::alert{type="warning"} Remember, this page transition cannot be overridden with `definePageMeta` on individual pages. ::