Rotating Headline, animated React component
A hero headline whose words arrive one by one out of a blur, ending on a word that keeps rolling to the next, with a subline that follows word by word and a replay button.
- Free
- Motion Effects
- Spring
Like Rotating Headline? 301 more are in Pro.
Pro unlocks all 301 Pro components, every template and block, and everything we release next. Rotating Headline stays free.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| lead | string | "Built to" | The words that stay put. |
| words | string[] | ["move.", "delight.", "last.", "ship."] | Words that take turns at the end. |
| sub | string | — | Subline under the headline. |
| accent | string | "#0071e3" | Colour of the rotating word. |
| interval | number | 2000 | Milliseconds between word changes. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry
Run this once per project. It writes the Nexus UI entry into
components.jsonfor you:npx shadcn@latest registry add "@nexus-labs=https://www.nexus-ui.com/api/registry/{name}"Type it exactly as shown.
{name}is filled in by the CLI with the component you ask for, so you never replace it.
- 3
Add the component
Run this from your project root. It adds the component, the helpers it imports and its npm packages.
npx shadcn@latest add @nexus-labs/rotating-headline
- 4
Check what was added
With a project made as in the Quick Start (a
src/folder), these files land in it:components/rotating-headline/index.tsrotating-headline.tsx - 5
Copying by hand? Skip the registry
Instead of steps 2 and 3 you can copy the files yourself, with no registry and no API key. Step 1 still applies, so that
cn()exists. Install the packages:npm install framer-motion
Then show the source and create each file at the path it gives:
- 6
Use it in a page
Installing only adds the files. Import the component in a page and render it. The Usage tab on the preview shows a fuller example with props:
// src/app/page.tsx import { RotatingHeadline } from "@/components/rotating-headline"; export default function Page() { return ( <main> <RotatingHeadline /> </main> ); }
Like Rotating Headline? 301 more are in Pro.
Pro unlocks all 301 Pro components, every template and block, and everything we release next. Rotating Headline stays free.
Rotating Headline questions
How do I install Rotating Headline?
Run `npx shadcn@latest add @nexus-labs/rotating-headline`. It is a free component and installs framer-motion.
How do I change the text and the rotating words?
`lead` is the fixed text (default "Built to"), `words` is the list that takes turns at the end (default "move.", "delight.", "last.", "ship."), and `sub` is the line below. Include any punctuation in `words`, and keep them distinct.
How do I change the speed and color?
`interval` is the time between word changes in milliseconds (default 2000). `accent` sets the color of the rotating word (default "#0071e3"). The word rolls up and out of a blur with a spring.
What does the Replay reveal button do?
It re-mounts the headline and subline so the entrance plays again: each word of `lead` and `sub` fades in from a blur, one after another. The button is part of the component, so remove it in the file if you do not want it.
Can I pause the rotation?
There is no prop for it. The rotating word changes every `interval` milliseconds for as long as the component is mounted, looping through `words` in order.