Text

Word Cycle

The word changes out of a blur, and the sentence never jumps in width.

Preview

Installation

Terminal
npx @usefluid/cli add word-cycle

Usage

WordCycle.tsx
import { WordCycle } from "./WordCycle";

<h1>Made for <WordCycle words={["shops.", "clinics.", "you."]} loop={false} /></h1>

API reference

PropTypeDefaultDescription
wordsstring[]—Short words. The box takes the width of the longest.
everynumber1.6Seconds per word.
loopbooleantrueFalse stops on the last word.
playbooleantrue

Keyboard and screen readers

Screen readers and reduced motion get the last word only.

Notes

Words do not wrap, so keep them to one or two words. In the product, prefer loop={false}.

Every colour comes from the --fluid-* variables, and the piece is yours to change.

How it is made

Every word sits stacked in the same grid cell, invisible, so the sentence keeps the width of the longest one. The new word comes in from a blur and the old one leaves upwards. Screen readers hear a single word.

For your agent

For your agent

Add Word Cycle to my project with the Fluid library. Use WordCycle in the main headline, with words that describe my audience. Read my project first. Use my logo, my colours and my font through the --fluid-* variables. Keep 44px touch targets, visible focus and reduced motion. If I have no SVG logo, ask before making one up.