---
title: "Defaults"
description: "Set default props for the transition components and default parameters for useAnimate and useDraggable, for the whole app or part of it."
canonical_url: "https://nanimejs.netlify.app/guides/defaults"
---
# Defaults

> Set default props for the transition components and default parameters for useAnimate and useDraggable, for the whole app or part of it.

Set a default once instead of passing the same prop or parameter to every
component and call. A prop or parameter you pass wins over
`provideAnimeDefaults()`, which wins over `app.config.ts`, then the
[preset](https://nanimejs.netlify.app/guides/presets), then the built-in value.

## Set app-wide defaults

```ts [app/app.config.ts]
export default defineAppConfig({
  nanime: {
    components: {
      transition: { animation: 'slide-up', mode: 'out-in' },
      transitionGroup: { animation: 'swap', moveAnimation: { duration: 600, ease: 'out(4)' } },
      layoutGroup: { layoutOptions: { duration: 500 } },
    },
    composables: {
      animate: { duration: 500, ease: 'out(3)' },
      draggable: { releaseEase: 'out(3)', dragSpeed: 2 },
    },
  },
})
```

### What can be a default

<table>
<thead>
  <tr>
    <th align="left">
      Entry
    </th>
    
    <th align="left">
      Props that can be defaults
    </th>
    
    <th align="left">
      Built-in value when unset
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td align="left">
      <code>
        components.transition
      </code>
    </td>
    
    <td align="left">
      <code>
        waapi
      </code>
      
      , <code>
        animation
      </code>
      
      , <code>
        enterAnimation
      </code>
      
      , <code>
        leaveAnimation
      </code>
      
      , <code>
        mode
      </code>
      
      , <code>
        appear
      </code>
      
      , <code>
        completeOnTabHidden
      </code>
    </td>
    
    <td align="left">
      <code>
        fade
      </code>
      
       (enter 300ms, leave 200ms), <code>
        mode: 'default'
      </code>
      
      , <code>
        appear: false
      </code>
    </td>
  </tr>
  
  <tr>
    <td align="left">
      <code>
        components.transitionGroup
      </code>
    </td>
    
    <td align="left">
      <code>
        tag
      </code>
      
      , <code>
        waapi
      </code>
      
      , <code>
        animation
      </code>
      
      , <code>
        enterAnimation
      </code>
      
      , <code>
        leaveAnimation
      </code>
      
      , <code>
        moveAnimation
      </code>
      
      , <code>
        appear
      </code>
      
      , <code>
        absoluteLeave
      </code>
      
      , <code>
        shallow
      </code>
      
      , <code>
        completeOnTabHidden
      </code>
    </td>
    
    <td align="left">
      enter 250ms with <code>
        out(3)
      </code>
      
      , leave 150ms with <code>
        in(3)
      </code>
      
      , move 350ms with <code>
        out(3)
      </code>
      
      , <code>
        tag: 'div'
      </code>
      
      , <code>
        absoluteLeave: true
      </code>
    </td>
  </tr>
  
  <tr>
    <td align="left">
      <code>
        components.layoutGroup
      </code>
    </td>
    
    <td align="left">
      <code>
        tag
      </code>
      
      , <code>
        shallow
      </code>
      
      , <code>
        layoutOptions
      </code>
      
      , <code>
        elements
      </code>
      
       (selector string or list of strings), <code>
        completeOnTabHidden
      </code>
    </td>
    
    <td align="left">
      <code>
        spring({ bounce: 0.15, duration: 300 })
      </code>
      
      , <code>
        tag: 'div'
      </code>
    </td>
  </tr>
  
  <tr>
    <td align="left">
      <code>
        composables.animate
      </code>
    </td>
    
    <td align="left">
      any <code>
        AnimationParams
      </code>
    </td>
    
    <td align="left">
      none
    </td>
  </tr>
  
  <tr>
    <td align="left">
      <code>
        composables.draggable
      </code>
    </td>
    
    <td align="left">
      any <code>
        DraggableParams
      </code>
      
       except <code>
        trigger
      </code>
      
       and <code>
        container
      </code>
    </td>
    
    <td align="left">
      none
    </td>
  </tr>
</tbody>
</table>

`deps` cannot be a default, because every group watches different values.
Element refs and component instances exist only inside a component, so
they cannot be defaults either.

A composable parameter passed as `undefined` keeps the default, as it does
in AnimeJS, so `{ duration: props.duration }` works when the prop is not
set.

## Scope defaults to part of the app

Use `provideAnimeDefaults()` when one part of the app needs different
defaults from the rest.

```vue [components/SettingsPanel.vue]
<script setup lang="ts">
provideAnimeDefaults({
  transition: { animation: 'scale' },
  composables: { animate: { duration: 300 } },
  rebuild: 'keepTime',
})
</script>
```

<table>
<thead>
  <tr>
    <th align="left">
      Key
    </th>
    
    <th align="left">
      Type
    </th>
    
    <th align="left">
      Notes
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td align="left">
      <code>
        transition
      </code>
      
      , <code>
        transitionGroup
      </code>
      
      , <code>
        layoutGroup
      </code>
    </td>
    
    <td align="left">
      same as the <code>
        components
      </code>
      
       entries
    </td>
    
    <td align="left">
      Replaces the same entry from a parent component's call, so repeat any of the parent's keys you still need, such as <code>
        mode
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td align="left">
      <code>
        composables
      </code>
    </td>
    
    <td align="left">
      <code>
        { animate?, draggable? }
      </code>
    </td>
    
    <td align="left">
      <code>
        animate
      </code>
      
       and <code>
        draggable
      </code>
      
       each replace the same entry from a parent component's call.
    </td>
  </tr>
  
  <tr>
    <td align="left">
      <code>
        preset
      </code>
    </td>
    
    <td align="left">
      <code>
        AnimationPreset
      </code>
    </td>
    
    <td align="left">
      Replaces the app-wide preset for the components and composables inside.
    </td>
  </tr>
  
  <tr>
    <td align="left">
      <code>
        rebuild
      </code>
    </td>
    
    <td align="left">
      <code>
        'restart'
      </code>
      
      , <code>
        'keepTime'
      </code>
      
       or <code>
        'keepValue'
      </code>
    </td>
    
    <td align="left">
      Default <code>
        rebuild
      </code>
      
       for <code>
        useAnimate
      </code>
      
      , <code>
        useScrambleText
      </code>
      
       and <code>
        useAnimeTimeline
      </code>
      
       inside. <code>
        'keepValue'
      </code>
      
       applies to <code>
        useAnimate
      </code>
      
       only, and the other two composables use <code>
        'restart'
      </code>
      
       instead.
    </td>
  </tr>
</tbody>
</table>

The argument can also be a ref or a getter. A key passed as `undefined`,
such as `transition: undefined`, keeps the value from a parent component's
call.

`transitions` and `reducedMotion` can only be set app-wide, so
`provideAnimeDefaults()` does not accept them.


## Sitemap

See the full [sitemap](https://nanimejs.netlify.app/sitemap.md) for all pages.
