An entrance that slides elements into place on load or when they scroll into view.
Installation
Usage
<script setup lang="ts">
import { Slide, Slides } from '@animate-ui/vue/primitives/effects/slide';
import Card from './Card.vue';
</script>
<template>
<Slide direction="up">
<h1>Animated primitives for Vue</h1>
</Slide>
<!-- Staggered: each child starts 100ms after the previous one. -->
<Slides :hold-delay="100" direction="up">
<Card />
<Card />
<Card />
</Slides>
</template>With as-child, the animation is applied to your element instead of a wrapping div.
Animation
- The element travels
offsetpixels (100 by default) into place on a spring (stiffness 200, damping 20), overshooting by about 4% before it settles. It moves withx/y, a hardware-accelerated transform. directionis the direction it moves in:upstarts below its place.- Under reduced motion, it doesn't travel: it fades in instead.
in-viewwaits for the element to scroll into view, once by default.<AnimateUIProvider :tempo>paces the default spring.
API Reference
Slide
| Prop | Type | Default |
|---|---|---|
as-child? | boolean | false |
direction? | 'up' | 'down' | 'left' | 'right' | 'up' |
offset? | number | 100 |
delay? | number | 0 |
transition? | Transition | { type: 'spring', stiffness: 200, damping: 20 } |
in-view? | boolean | false |
in-view-once? | boolean | true |
in-view-margin? | string | '0px' |
...props? | HTMLMotionProps<'div'> | - |
Slides
Wraps each child in a Slide, delaying each one a little more than the previous.
| Prop | Type | Default |
|---|---|---|
#default | slot | - |
hold-delay? | number | 0 |
...props? | SlideProps | - |