transition Properties

The pageTransition Property

Nuxt v2.7.0 introduces key “pageTransition” in favor of the “transition” key to consolidate the naming with layout transition keys.

  • Type: String or Object

Used to set the default properties of the page transitions.

Default:

  1. {
  2. name: 'page',
  3. mode: 'out-in'
  4. }

Example (nuxt.config.js):

  1. export default {
  2. pageTransition: 'page'
  3. // or
  4. pageTransition: {
  5. name: 'page',
  6. mode: 'out-in',
  7. beforeEnter (el) {
  8. console.log('Before enter...');
  9. }
  10. }
  11. }

The transition key in nuxt.config.js is used to set the default properties for the page transitions. To learn more about the available keys when the transition key is an object, see the pages transition property.

The layoutTransition Property

  • Type: String or Object

Used to set the default properties of the layout transitions. The value provided in the name option is configured to work with the name provided in layout from your layouts folder.

Default:

  1. {
  2. name: 'layout',
  3. mode: 'out-in'
  4. }

Example (nuxt.config.js):

  1. export default {
  2. layoutTransition: 'layout'
  3. // or
  4. layoutTransition: {
  5. name: 'layout',
  6. mode: 'out-in'
  7. }
  8. }

Example global css:

  1. .layout-enter-active,
  2. .layout-leave-active {
  3. transition: opacity 0.5s;
  4. }
  5. .layout-enter,
  6. .layout-leave-active {
  7. opacity: 0;
  8. }