Loading preview…
Installation
terminal
terminal
terminal
terminal
Or, with @layro in your components.json:
terminal
Code
'use client';
import {
AnimatePresence,
Transition,
Variant,
motion,
MotionProps,
} from 'motion/react';
import { cn } from '@/lib/utils';
export type TransitionPanelProps = {
children: React.ReactNode[];
className?: string;
transition?: Transition;
activeIndex: number;
variants?: { enter: Variant; center: Variant; exit: Variant };
} & MotionProps;
export function TransitionPanel({
children,
className,
transition,
variants,
activeIndex,
...motionProps
}: TransitionPanelProps) {
return (
<div className={cn('relative', className)}>
<AnimatePresence
initial={false}
mode='popLayout'
custom={motionProps.custom}
>
<motion.div
key={activeIndex}
variants={variants}
transition={transition}
initial='enter'
animate='center'
exit='exit'
{...motionProps}
>
{children[activeIndex]}
</motion.div>
</AnimatePresence>
</div>
);
}Versions
1.0.0 · current
Oct 30, 2026
First release.







