Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Text

  • Text
  • Heading
  • SectionHeader
  • Prose
  • Markdown
  • Formula
  • AuroraText
  • LineShadowText
  • AnimatedShinyText
  • AnimatedGradientText
  • WordRotate
  • TypingAnimation
  • SparklesText
  • SplitText
  • BlurText
  • FlipText
  • TextReveal
  • DecryptedText
  • GlitchText
  • CircularText
  • ScrollReveal
  • TrueFocus
  • ASCIIText
  • CurvedLoop
  • FallingText
  • FuzzyText
  • ScrambledText
  • ScrollFloat
  • ScrollVelocity
  • Shuffle
  • TextCursor
  • TextPressure
  • VariableProximity

Code

  • Code
  • CodeBlock
  • Snippet
  • CodeDiff
  • Kbd

WordRotate

word-rotate

Cycles through words with enter and exit transitions.

Usage

Basic usage

Pass in the word array, AnimatePresence rotates up and down word by word (the default stay is 2.5s per word).

Let Development Faster
tsx
<div className="text-3xl font-bold text-foreground">
  Let the development <WordRotate words={["faster", "more stable", "more beautiful", "Hulian"]} className="text-primary" />
</div>

Rotation interval

duration controls the milliseconds for each word to stay. The smaller it is, the faster the switching is.

Design
tsx
<div className="text-3xl font-bold text-foreground">
  <WordRotate words={["Design", "Development", "Delivery"]} duration={1200} className="text-primary" />
</div>

Pure rotation slogan

Use a separate line as the slogan Hero, and mix the prefix and suffix copywriting.

Focus Efficiency Component Library
tsx
<div className="text-4xl font-bold text-foreground">
  Focus on the component library of <WordRotate words={["efficiency", "experience", "aesthetics"]} className="text-chart-2" />
</div>

When to use

Use WordRotate to cycle alternatives inside a fixed phrase, such as “Build faster / safer / more beautifully,” with Motion enter and exit transitions. Use TypingAnimation for character-by-character typing, or Text for static copy. Motion and state make this a client component.

Import

ts
import { WordRotate } from "@hulianui/ui"

Props

NameTypeDefaultDescription
words*string[]-rotated word array
durationnumber2500milliseconds per word

Inherit ComponentPropsWithoutRef<"span"> (except children and motion conflict onDrag/onDragStart/onDragEnd/onAnimationStart), such as className / style.

Example

tsx
<div className="text-3xl font-bold text-foreground">
  Build <WordRotate words={["faster", "safer", "more beautifully", "with HulianUI"]} className="text-primary" />
</div>

Usage guidelines

  • Props pass to motion.span, but the public type excludes onDrag, onDragStart, onDragEnd, and onAnimationStart because Motion 12 gives them gesture/animation signatures that conflict with DOM handlers.
  • The "use client" component may be nested under a server component but is not itself a pure RSC.
  • Under prefers-reduced-motion, word changes remain visible without animated enter and exit transitions.

Related

Text · Heading · Prose · Markdown · AuroraText · AnimatedShinyText

Playground

Let Development Faster
<WordRotate words={["faster", "more stable", "more beautiful"]} duration={2000} />
PreviousAnimatedGradientTextTypographyNextTypingAnimation

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Example
    • Usage guidelines
    • Related
  • Playground