Sora UI

Text Loop

Cycles through a list of items with an enter/exit animation, powered by Motion. A React component.

Made by Axyl
Loading...

Headline that cycles through a set of phrases on an interval.

Installation

npx shadcn@latest add @soralabs/text-loop

File Structure

text-loop.tsx

Usage

Pause cycling and drive the index manually:

Props

PropTypeDefault
children
ReactNode[]
-
interval?
number
2
trigger?
boolean
true
mode?
"sync" | "wait" | "popLayout"
"popLayout"
live?
"off" | "polite" | "assertive"
"off"
variants?
Variants
-
transition?
Transition
-
onIndexChange?
(index: number) => void
-
className?
string
-

When to Use

Use TextLoop for short rotating copy where a hard cut would feel abrupt: hero headlines, rotating value props, or status text that changes over time. Keep items short and similar in width, since the container does not reserve space for the widest item.

Accessibility

Set live="polite" if the cycling text conveys information users should be notified of; leave it "off" (default) for purely decorative rotating copy, since a live region firing every interval seconds is disruptive for screen reader users. When prefers-reduced-motion: reduce is set, the component still swaps the active item on each interval but skips the enter/exit motion via useReducedMotion() — no extra configuration needed.

Credits

Inspired by motion-primitives.

Built by Axyl. A motion-first component registry for React.

Last updated: 9/14/2026

On this page

Help keep SoraLabs moving.

Every contribution helps us build and maintain open-source tools for the community.

Sponsor on GitHub