Skip to content
Textlab
1
Browse

ComponentsPhysics

Letter drop

Letters fall, bounce and settle on the floor.

Gravity

Installation

$ npx shadcn@latest add @textlab/letter-drop

Needs @textlab in your components.json. Setup takes a minute.

Usage

usage.tsx
import { LetterDrop } from "@/components/textlab/letter-drop/letter-drop";

<LetterDrop as="h2" text="Gravity" variant="pile" />

Variants

droppiletoss

Props

PropTypeDefaultDescription
text*string–The copy.
variant"drop" | "pile" | "toss""drop"Fall straight and bounce, tumble and land askew, or also fling up on click or tap.
heightnumber2.2Fall height in em.
restitutionnumber0.45Bounciness, 0 to 0.9.
asElementType"span"Rendered element.
trigger"mount" | "inView" | "manual""inView"What starts the animation. manual follows `active`.
activebooleanfalseDrives trigger="manual".
oncebooleantrueIn view: play once instead of on every entry.
staggernumber0.06Seconds between parts.
reducedMotion"user" | "always" | "never""user"user follows the OS setting; always shows the still version.
classNamestring–Merged onto the root.

When to use it

Reach for it

  • Playful launches, games and kids' products.
  • A single word that should land with weight.

Skip it

  • Serious contexts.
  • Long sentences; each letter is a body.

Accessibility and motion

Accessibility

  • Letters are aria-hidden; the word is read once.
  • Toss works with click and tap; it is a bonus, never needed to read the word.

Motion

  • Real gravity with energy lost on every bounce.
  • Pile letters spin as they fall and settle up to 8 degrees off true.
Reduced motion. The word sits on the baseline from the start.

Performance

  • One frame loop that stops once every letter has settled.