Gravity Field
betaA box where a click drops a glyph and holding pours a stream: letters, digits or your own nodes fall, tumble and pile up.
- Effects & motion
- 2 files
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add gravity-fieldnpm packages installed: class-variance-authority.
import { GravityField } from "@/components/ui/gravity-field";Default
Gallery
Numbers
Letters And Numbers
Emoji
Icons
Floaty
Capped
Device Tilt
Imperative
<GravityField>
| Prop | Type | Default |
|---|---|---|
deviceTiltLet a phone's tilt steer gravity, asking for sensor permission on first tap where required. | boolean | false |
gravityDownward acceleration in px/s². Lower is floatier. | number | 2000 |
handleRefImperative | Ref<GravityFieldHandle> | — |
itemsYour own drop pool — emoji, icons, any node. Each drop picks one at random. | ReactNode[] | — |
labelAccessible name of the field, which is a button. | string | "Drop a glyph" |
maxGlyphsGlyphs kept in the field. Past it the oldest fade out. Unlimited by default. | number | Infinity |
poolWhich characters drop: A–Z, 0–9, or both. Ignored when | GravityFieldPool | "letters" |
sizeBase glyph size in pixels; each drop varies around it by ±15%. | number | 36 |
surface | "muted" | "outline" | "plain" | "muted" |
Plus every attribute of <div>.
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 — does not apply
- className merged — passes
- Visible focus — passes
- No fixed widths — passes