Random Text Reveal
Per-character text reveal in shuffled order when the text enters the viewport. Unrevealed glyphs sit faint while random letters resolve into solid type — scattered across the whole paragraph, never left-to-right.
Installation#
pnpm dlx shadcn@latest add @davinciui/random-text-revealUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
textText content. Words wrap naturally; characters reveal independently. | string | "DavinciUI gives you production-ready components…" |
fontFamilyFont family applied to the text. | string | — |
fontSizeFont size. Numbers become px; strings pass through. | number | string | 64 |
fontWeightFont weight applied to the text. | number | string | 600 |
fontStyleFont style applied to the text. | "normal" | "italic" | "normal" |
lineHeightLine height. Numbers are unitless multipliers. | number | string | 1.1 |
letterSpacingTracking. Numbers become px; strings pass through. | number | string | "-0.03em" |
colorFinal revealed character color (opacity animates, color stays). | string | "#000000" |
textAlignText alignment. | "left" | "center" | "right" | "justify" | "center" |
fromOpacityStarting opacity of unrevealed characters. | number | 0.12 |
toOpacityFinal opacity of revealed characters. | number | 1 |
durationPer-character transition duration, in seconds. | number | 0.35 |
minDelayEarliest per-character reveal delay, in seconds. | number | 0 |
maxDelayLatest per-character reveal delay, in seconds. | number | 1.5 |
easeGSAP easing for each character transition. | "Linear" | "Power1 Out" | "Power2 Out" | "Power3 Out" | "Power4 Out" | "Sine Out" | "Expo Out" | "Circ Out" | "Back Out" | "Power2 Out" |
animationModeReveal order across the text. | "random" | "forward" | "reverse" | "center-out" | "edges-in" | "random" |
triggerPositionViewport position that starts the reveal. | "top" | "center" | "bottom" | "center" |
triggerOffsetFine-tune trigger point in px (positive = later). | number | 0 |
replayRe-arm when leaving the viewport so re-entering replays. | boolean | true |
randomizeEachReplayFresh random distribution on every replay. | boolean | true |
loopAuto-replay on a timer after each completion (keeps looping in view). | boolean | false |
loopDelayPause between loop iterations, in seconds. | number | 2 |
seedFixed seed for a stable random order across renders. | number | — |
motionXOptional horizontal motion offset in px. | number | 0 |
motionYOptional vertical motion offset in px. | number | 0 |
motionScaleOptional starting scale. | number | 1 |
motionRotationOptional starting rotation in degrees. | number | 0 |
classNameAdditional classes for the outer element. | string | — |
styleAdditional inline styles for the outer element. | React.CSSProperties | — |
Accessibility#
The animated glyph tree is aria-hidden while an sr-only span exposes the full text once. There is no focusable UI or keyboard control, and reduced-motion users get the final readable state.
Motion#
Characters animate opacity plus optional x, y, scale, and rotation through GSAP; duration, minDelay, maxDelay, ease, animationMode, replay, and loop control timing and order. A matchMedia listener disables the timeline and renders the final state when prefers-reduced-motion is set.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

