shadimage
slidecn
uiauto-animate-pairsource: ok · hit

Auto Animate Pair

Two consecutive slides with auto-animate enabled for smooth transitions between states.

npx shadcn add "https://slidecn.vercel.app/r/auto-animate-pair.json"
free

Where it goes

stats

Interaction

animated-counter

Tags auto-generated by rules on 9/24/2026 — empty means no evidence, not lack of support.

Dependencies

Bundle weight · light
@revealjs/reactreveal.js

Files1 · source cached 10/8/2026, 2:11:45 PM

registry/slidecn/ui/auto-animate-pair.tsx
"use client";

import { Slide } from "@revealjs/react";
import type { SlideProps } from "@revealjs/react";
import type { ReactNode } from "react";

import { cn } from "@/lib/utils";

/**
 * Auto-animate pair renders two consecutive slides that animate between each other.
 * The caller must place a child with `data-id={animateId}` inside both `from` and `to`
 * for the animation to trigger.
 */
interface AutoAnimatePairProps extends SlideProps {
  animateId: string;
  from: ReactNode;
  to: ReactNode;
  easing?: string;
  duration?: number;
  notes?: string;
}

const AutoAnimatePair = ({
  animateId,
  from,
  to,
  easing,
  duration,
  className,
  notes,
  ...slideProps
}: AutoAnimatePairProps) => (
  <>
    <Slide
      className={cn(className)}
      autoAnimate
      autoAnimateId={animateId}
      autoAnimateEasing={easing}
      autoAnimateDuration={duration}
      {...slideProps}
    >
      {from}
      {notes && <aside className="notes">{notes}</aside>}
    </Slide>
    <Slide
      className={cn(className)}
      autoAnimate
      autoAnimateId={animateId}
      autoAnimateEasing={easing}
      autoAnimateDuration={duration}
      {...slideProps}
    >
      {to}
    </Slide>
  </>
);

export { AutoAnimatePair };

More from slidecn

Browse all components in this library →