Modus UI

Flip Words

Web (React)

A sleek text rotator that flips individual words sequentially using 3D perspective.

A typography component. It utilizes Framer Motion's AnimatePresence with mode="popLayout" to smoothly slide adjacent text over as the rotating word changes length, preventing the jarring layout jumps seen in most word rotators.

Buildbeautifulinterfaces with Modus UI.

Installation

CLI

npx @modus-ui/cli add flip-words

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/flip-words.tsx.
  3. Paste the code.

Usage

tsx
import { FlipWords } from "@/components/ui/flip-words";

export default function Example() {
  return (
    <h2>
      Build <FlipWords words={["fast", "beautiful", "modern"]} /> websites.
    </h2>
  );
}

Props

PropTypeDefaultDescription
wordsstring[]-The words to cycle through.
intervalnumber2Seconds each word stays visible.
durationnumber0.5Seconds each flip animation takes.

Comments

  • No comments yet.