Timeline Animation
A timeline animation built with Framer Motion that animates sections one after another as they enter the viewport. Supports an animationNum prop to control when each item in the timeline animates.
A timeline animation built with Framer Motion that animates sections one after another as they enter the viewport. Supports an animationNum prop to control when each item in the timeline animates.
npx uilayouts@latest add timeline-animation
1const timelineRef = useRef<HTMLDivElement>(null);23<TimelineAnimation as='h2' animationNum={1} ref={timelineRef}>4Default fade/slide animation5</TimelineAnimation>
1const timelineRef = useRef<HTMLDivElement>(null);23const revealVariants = {4hidden: { opacity: 0, scale: 0.8 },5visible: { opacity: 1, scale: 1, transition: { duration: 0.5 } },6};78<TimelineAnimation as='button' ref={timelineRef} animationNum={2} customVariants={revealVariants}>9Custom animation10</TimelineAnimation>;
<a> Link1const timelineRef = useRef<HTMLDivElement>(null);23<TimelineAnimation4as='a'5href='https://pro.ui-layouts.com/test'6animationNum={3}7customVariants={revealVariants}8ref={timelineRef}9className='group rounded-lg border p-4'10>11Clickable card12</TimelineAnimation>
| Prop | Type | Default | Description | 
|---|---|---|---|
| children | React.ReactNode | — | The content to be displayed within the timeline. | 
| as | keyof HTMLElementTagNameMap | "div" | The HTML element to render (div, a, section, etc.). | 
| animationNum | number | — | A number used to stagger animations for multiple items. | 
| viewport | { amount?: number; margin?: string; once?: boolean } | { amount: 0.3, margin: "0px 0px -120px 0px", once: true } | Controls when the animation triggers in the viewport. | 
| customVariants | Variants | — | Optional set of custom Framer Motion variants for hidden and visible animations. | 
| className | string | — | Optional CSS classes to style the timeline element. | 
| delay | boolean | — | Optional delay properties for adding delay animation between timeline. | 
| ...props | ComponentPropsWithoutRef<T> | — | All other native HTML props for the element (e.g., href, target, rel for <a>). |