Introducing Motion-Primitives Pro - Advanced components and templates to help you build a website that stands out.

Text Loop

Text animation that transitions between multiple items, creating an engaging looping effect

Examples

Text Loop Basic

How can I assist you today?

Text Loop with custom variants and transition

Beautiful templates for

Founders

Text Loop with onIndexChange

You can use the onIndexChange prop to trigger a callback function when the index changes. In this example, we use it to create alternating animation directions.

A Little Lost・Arthur Russell

Installation

npx shadcn add "https://motion-primitives.com/c/text-loop.json"

Component API

Text Loop

PropTypeDefaultDescription
childrenReact.ReactNode[]The text content to be animated.
classNamestringAdditional CSS classes for styling.
intervalnumber2000Time interval between text changes in milliseconds.
transitionTransitionAnimation transition settings. Can't be more than inerval
variantsVariantsCustom animation variants.
onIndexChange(index: number) => voidCallback function that triggers when the index changes.
triggerbooleantrueWhether to trigger the animation.
modeAnimatePresenceProps['mode']popLayoutMode of for the AnimatePresence component.