Falling Text
betaText that lets go: its words or letters drop out of the line, tumble, bounce and pile up at the bottom of the box — then fly home on reset.
- Effects & motion
- 1 file
- No extra npm packages
- Accessibility notes
Loading the example…
pnpm dlx @dowel-ui/cli add falling-textNo npm packages are needed beyond what Dowel already requires.
import { FallingText } from "@/components/ui/falling-text";Default
Letters
Imperative
<FallingText>
| Prop | Type | Default |
|---|---|---|
children (required)The text. Plain text: it is split into words or letters. | string | — |
bounceHow much of its speed a piece keeps when it bounces, 0–1. Default 0.35. | number | 0.35 |
bySplit into words or single letters. Default "word". | "word" | "letter" | "word" |
fallenControlled: true drops the text, false brings it back. | boolean | — |
gravityGravity, in pixels per second squared. Default 2400. | number | 2400 |
handleRefImperative | Ref<FallingTextHandle> | — |
triggerWhat makes it fall. "click" makes the box a toggle button. Default "hover". | "hover" | "click" | "inView" | "manual" | "hover" |
Plus every attribute of <div> except children.
The text is read as written: a visually hidden copy carries it and the falling pieces are aria-hidden. With trigger="click" the box becomes a toggle button (role="button", aria-pressed) that Enter and Space also work; name it with aria-label if the text alone does not say what it does. Under reduced motion nothing falls — the text only dims to show it was triggered.
9/9
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — does not apply
- No fixed widths — passes