Turning Word

Roomtobreathe.

About this component

Turning Word

A sentence whose one word takes turns: each candidate blurs up into place as the last blurs out, on a timer that stops when reduced motion is preferred.

Usage

The import and the props worth knowing about, in one place.

import { Text4 } from "@/components/beste/component/text4";

<Text4
  as="h1"
  before="Room to"
  words={["breathe.", "think.", "rest.", "begin again."]}
  interval={2800}                      // ms per word
  className="font-serif text-7xl"
  wordClassName="text-muted-foreground"
/>

Playground

Turn the props on the right; the snippet under them is what you would write to get what you see.

Roomtobreathe.

Usage
import { Text4 } from "@/components/beste/component/text4";

<Text4
  before="Room to"
  words={["breathe.","think.","rest.","begin again."]}
  as="h2"
  className="px-6 text-center font-serif text-2xl font-normal leading-[1.05] tracking-[-0.02em] text-foreground md:text-3xl"
  wordClassName="text-muted-foreground"
/>

Props

Read from the component's own type, so this cannot drift from what it accepts.

PropTypeDefaultDescription
beforestringPrinted before the turning word
words*string[]Words that take turns
afterstringPrinted after the turning word
intervalnumberMilliseconds each word stays
trigger"view" | "mount""view" (default) settles the fixed words in when scrolled into view; "mount" plays at once
as"h1" | "h2" | "h3" | "p" | "span"
classNamestring
wordClassNamestringClasses for the turning word only, e.g. a muted colour

More Text components

View all Text

Roomtobreathe,andawayforward.

Word Stagger

Text that settles in one word at a time, each word rising a few pixels out of a soft blur. Plays on scroll by default, or immediately for heroes.

Notheard.

Strike and Replace

A sentence that corrects itself: a line is drawn through the old word from left to right, and the better word settles in beside it out of a soft blur.

Nothing changesall at once.

Line Reveal

Lines of text that rise into view out of their own clipped rows, one after another, the way a heading is unmasked line by line.

Slow Wave

A word whose letters rise and fall on one slow, continuous swell, each a beat behind the last, like a line of type resting on water. Stays still when reduced motion is preferred.

listened to

Highlight Sweep

An inline phrase that gets a soft highlight swept in behind it from the left when it scrolls into view, like a marker drawn across the words, without the text moving.

A

Circle Text

A line of text set around a circle that turns slowly, with room in the middle for an initial, an icon or a short word. A seal for corners, footers and hero edges.