Slide

An entrance that slides elements into place on load or when they scroll into view.

Design
Build
Ship
"use client"

import * as React from "react"
import {
  Slides,
  type SlideDirection,
} from "@animate-ui/react/primitives/effects/slide"
import { RepeatIcon } from "@hugeicons/core-free-icons"
import { HugeiconsIcon } from "@hugeicons/react"

import { Button } from "@/components/ui/button"

const ITEMS = ["Design", "Build", "Ship"]

export default function SlideDemo({
  delay = 0,
  direction = "up",
  offset = 100,
}: {
  delay?: number
  direction?: SlideDirection
  offset?: number
}) {
  const [key, setKey] = React.useState(0)

  return (
    <div className="flex flex-col items-center gap-6">
      <div key={`${key}-${delay}-${direction}-${offset}`} className="flex gap-3">
        <Slides holdDelay={100} delay={delay} direction={direction} offset={offset}>
          {ITEMS.map((item) => (
            <div
              key={item}
              className="flex h-20 w-24 items-center justify-center rounded-xl bg-accent text-sm font-medium"
            >
              {item}
            </div>
          ))}
        </Slides>
      </div>
      <Button variant="outline" size="sm" onClick={() => setKey((k) => k + 1)}>
        <HugeiconsIcon icon={RepeatIcon} strokeWidth={2} />
        Replay
      </Button>
    </div>
  )
}

Installation

npm install @animate-ui/react motion
pnpm add @animate-ui/react motion
yarn add @animate-ui/react motion
bun add @animate-ui/react motion

Usage

import { Slide, Slides } from '@animate-ui/react/primitives/effects/slide';

export function Hero() {
  return (
    <>
      <Slide direction="up">
        <h1>Animated primitives for React</h1>
      </Slide>

      {/* Staggered: each child starts 100ms after the previous one. */}
      <Slides holdDelay={100} direction="up">
        <Card />
        <Card />
        <Card />
      </Slides>
    </>
  );
}

With asChild, the animation is applied to your element instead of a wrapping div.

Animation

  • The element travels offset pixels (100 by default) into place on a spring (stiffness 200, damping 20), overshooting by about 4% before it settles. It moves with x / y, a hardware-accelerated transform.
  • direction is the direction it moves in: up starts below its place.
  • Under reduced motion, it doesn't travel: it fades in instead.
  • inView waits for the element to scroll into view, once by default.
  • <AnimateUIProvider tempo> paces the default spring.

API Reference

Slide

PropTypeDefault
asChild?
booleanfalse
direction?
'up' | 'down' | 'left' | 'right''up'
offset?
number100
delay?
number0
transition?
Transition{ type: 'spring', stiffness: 200, damping: 20 }
inView?
booleanfalse
inViewOnce?
booleantrue
inViewMargin?
string'0px'
...props?
HTMLMotionProps<'div'>-

Slides

Wraps each child in a Slide, delaying each one a little more than the previous.

PropTypeDefault
children
React.ReactElement | React.ReactElement[]-
holdDelay?
number0
...props?
SlideProps-

Built by Skyleen. The source code is available on GitHub.

Last updated: 10/18/2026

On this page