Getting Started
Déjà Vue lets you define and nest GSAP animations as Vue components.
Installation
npm install deja-vue@latestDéjà Vue does not bundle Vue or GSAP — your app must provide them as peer dependencies:
| Package | Version |
|---|---|
vue | ^3.5.0 |
gsap | ^3.0.0 |
If they are not already in your project:
npm install vue gsapGreenfield projects
Install everything in one step:
npm install deja-vue@latest vue gsapnpm 7+ may install missing peers automatically; if you see peer warnings, add vue and gsap explicitly.
GSAP plugins
Déjà Vue registers the plugins its components use. You do not need gsap.registerPlugin() in app setup for:
| Plugin | Registered when you import |
|---|---|
| ScrollTrigger | Tween, Timeline, or Animation |
| SplitText | SplitText or useSplitText |
Register other GSAP plugins yourself (e.g. MorphSVG) if you use them in tween vars or imperative code.
If you call ScrollTrigger or SplitText APIs directly — outside deja-vue components — import the matching export from deja-vue first, or call gsap.registerPlugin() yourself.
Basic usage
<script setup>
import { Tween } from 'deja-vue'
</script>
<template>
<Tween :to="{ x: 56 }">
<div class="target" />
</Tween>
</template>Trigger
<script setup>
import { ref } from 'vue'
import { Tween } from 'deja-vue'
const isPlaying = ref(false)
</script>
<template>
<button @click="isPlaying = !isPlaying">
{{ isPlaying ? 'Reverse' : 'Play' }}
</button>
<Tween
:trigger="isPlaying"
:trigger-action="isPlaying ? 'play' : 'reverse'"
:to="{ x: 56 }"
>
<div class="target" />
</Tween>
</template>See Animation controls.
Progress
<script setup>
import { ref } from 'vue'
import { Tween } from 'deja-vue'
const progress = ref(0)
</script>
<template>
<Tween
v-model:progress="progress"
:to="{ x: 56 }"
>
<div class="target" />
</Tween>
</template>Sequences
See Timeline — Basic timeline sequence and Nesting.