Guides

Presets

Set the motion of the whole app, or of part of it, from one object.

A preset bundles transition styles, component defaults and composable defaults into one object, so the motion of an app comes from one place.

Pick a built-in preset

AnimeTransition
useAnimate
useDraggable
Formal
View on GitHub

The <AnimeTransition> box (a scale transition) and the useAnimate() box toggle every few seconds, and picking a preset toggles them immediately. Drag the useDraggable() box to feel its release physics.

PresetMotionEnter / leave (slide, scale, list)Easing
nanime/presets/formalCalm and precise, no overshoot150ms / 110msIBM Carbon productive curves
nanime/presets/elegantSoft and unhurried, no overshoot400ms / 280msIBM Carbon expressive curves
nanime/presets/playfulBouncy, overshoots about 10% on the way inspring / 180msspring(), with in(3) for exits

fade, the default for <AnimeTransition>, is shorter than the other styles in every preset and never overshoots.

Each preset redefines the built-in style names (fade, slide-up, slide-down, slide-left, slide-right, scale, swap) with its own timing, and adds a list style that <AnimeTransitionGroup> uses by default. Each preset also sets the timing of <AnimeLayoutGroup>, the defaults of useAnimate() and the release physics of useDraggable().

Valueformalelegantplayful
Slide distance8px12px20px
scale starts at0.960.970.85
fade enter / leave110ms / 70ms300ms / 240ms200ms / 150ms
Moves and layout240ms500msspring
useAnimate()240ms400ms400ms
useDraggable() releasestiffness 300, damping 34stiffness 100, damping 20stiffness 200, damping 28

Each preset exports its easings by name: standard, entrance and exit from formal, glide and settle from elegant, and pop and bounce from playful. Pass one to any animation:

import { entrance } from 'nanime/presets/formal'

useAnimate(box, { x: 120, ease: entrance })

Set a preset for the whole app

Pass the imported preset object to nanime.preset in app.config.ts, not a preset name:

app/app.config.ts
import formal from 'nanime/presets/formal'

export default defineAppConfig({
  nanime: {
    preset: formal,
  },
})

Component props, provideAnimeDefaults() and the rest of app.config.ts win over the preset. The preset wins over the built-in defaults.

Write a preset

Write your own when none of the built-in presets fits.

KeyHoldsRequired
sharedNamed transition styles the preset adds, in the same shape as nanime.transitions.No
componentsDefault props for transition, transitionGroup and layoutGroup.Yes
composablesDefault parameters for animate and draggable.Yes

composables can be an empty object. components needs all three entries, and each can be an empty object.

app/app.config.ts
export default defineAppConfig({
  nanime: {
    preset: {
      shared: {
        pop: {
          enter: { opacity: [0, 1], scale: [0.4, 1], duration: 240, ease: 'outBack(3)' },
          leave: { opacity: 0, scale: 0.4, duration: 140, ease: 'in(3)' },
          move: { duration: 200, ease: 'out(3)' },
        },
      },
      components: {
        transition: { animation: 'pop' },
        transitionGroup: { animation: 'pop' },
        layoutGroup: { layoutOptions: { duration: 400, ease: 'out(3)' } },
      },
      composables: {
        animate: { duration: 400, ease: 'out(3)' },
        draggable: { releaseEase: 'out(3)' },
      },
    },
  },
})

The names in shared work in the animation props of the components, the same as a style from app.config.ts.

A style name is looked up in nanime.transitions first, then in the preset's shared styles, then in the built-in styles. enter-animation and leave-animation each look up their own name, so <AnimeTransition enter-animation="pop" leave-animation="fade"> takes pop from the preset and fade from wherever fade is defined.

Scope a preset to part of the app

Use provideAnimeDefaults({ preset }) when one part of the app needs a different preset. It replaces the app-wide preset, and any preset from a parent component's call, for everything inside the calling component.

components/MarketingSection.vue
<script setup lang="ts">
import playful from 'nanime/presets/playful'

provideAnimeDefaults({ preset: playful })
</script>
Copyright © 2026