Background Beams With Collision
interlace-ui/background-beams-with-collisionFreeComponent
A hero surface where thin vertical beams fall from the top and burst into a ten-particle explosion when they reach the strip along the bottom. Your children render above them on a `z-10` layer.
Install it
npx shadcn@latest add https://ds.interlace.tools/r/background-beams-with-collision.jsonSource
1"use client";23import { cn } from "@/lib/utils";45// @interlace/background-beams-with-collision v1.2.0 — Interlace design system.6// Docs, props and live preview: https://ds.interlace.tools/c/background-beams-with-collision7// What changed since: https://ds.interlace.tools/c/background-beams-with-collision#history8// Generated banner — keep it, the upgrade diff reads this version.910/**11 * @interlace/ui — BackgroundBeamsWithCollision12 *13 * A hero surface where thin vertical beams fall from the top and burst into a14 * ten-particle explosion when they reach the strip along the bottom. Your15 * children render above them on a `z-10` layer.16 *17 * The container is `h-96 md:h-[40rem]` unless `containerClassName` says18 * otherwise.19 *20 * Our reimplementation of the Aceternity UI effect of the same name. What is21 * ours: the beams are painted from `--primary` / `--chart-2` rather than the22 * upstream purple/indigo literals, so they re-resolve per theme; an23 * `IntersectionObserver` unmounts the whole beam layer when the hero scrolls24 * out of view; the collision poll runs at 200ms instead of 50ms; and the25 * explosion is ten particles instead of twenty.26 *27 * ## Anatomy28 *29 * div (parent — gradient, overflow-hidden,30 * contain: layout style paint)31 * ├─ CollisionMechanism ×beams (motion.div beam + AnimatePresence)32 * │ └─ Explosion (glow line + 10 motion.span particles)33 * ├─ div.z-10 (your children)34 * └─ div (collision surface, bottom strip —35 * styling suppressed by hideCollisionSurface)36 *37 * Each beam is a `BeamConfig` (`initialX`, `translateY`, `duration`, `delay`,38 * `repeatDelay`, `className`); `beams` replaces the seven-beam default wholesale.39 *40 * ## Motion41 *42 * JS-driven throughout — `motion/react` transforms for the fall, a43 * `setInterval` collision poll, and `AnimatePresence` for the burst. None of44 * it is reachable by the CSS reset in `styles/preflight.css`, so the gate is45 * in JS and it is total: `{isVisible && !reduceMotion && beams.map(…)}` means46 * that under `prefers-reduced-motion: reduce` no `CollisionMechanism` mounts47 * at all — no beams, no interval, no explosions. What remains is the gradient48 * background, the collision strip, and your content. That is the intended49 * still state, not a degraded one.50 *51// … truncated
More from interlace-ui
All 140 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| A11y Startera11y-starter | interlace-ui | Components | Free | no deps | |
| Accordionaccordion | interlace-ui | Components | Free | no deps | |
| Alertalert | interlace-ui | Components | Free | no deps | |
| Alert Dialogalert-dialog | interlace-ui | Components | Free | no deps | |
| Animated Gradient Textanimated-gradient-text | interlace-ui | Components | Free | no deps | |
| Animated Grid Patternanimated-grid-pattern | interlace-ui | Components | Free | no deps | |
| Animated Listanimated-list | interlace-ui | Components | Free | no deps | |
| Article Cardarticle-card | interlace-ui | Components | Free | no deps |
