Radiant Lines
A hyperspace starfield background — colored streaks from the center, warp speed driven by scroll.
Canvas starfield in the spirit of those GSAP hyperspace scroll demos: stars project from the center as streaks. Scroll velocity boosts warp; displacement scales how far each star jumps. Release and it eases back to a drift.
Colors
Star count
420Displacement
1Installation
pnpm dlx shadcn@latest add @23rd/radiant-linesOr install straight from the public GitHub source registry:
pnpm dlx shadcn@latest add radiumcoders/23rd.dev/radiant-linesUsage
Place it behind content in a relatively positioned container. Pass a scroll container when scroll happens inside an overflow element instead of the window.
"use client"
import { useRef } from "react"
import { RadiantLines } from "@/components/ui/radiant-lines"
export function Hero() {
const ref = useRef<HTMLDivElement>(null)
return (
<div ref={ref} className="relative h-svh overflow-y-auto">
<RadiantLines containerRef={ref} className="sticky top-0 h-svh" />
<div className="relative z-10 p-10">Your content</div>
</div>
)
}Props
| Prop | Type | Default |
|---|---|---|
colors | string[] | coral / teal / amber / blue / pink / lime / slate |
starCount | number | 420 |
displacement | number | 1 — how far each star jumps on warp / scroll |
containerRef | RefObject<HTMLElement | null> | React — window scroll |
container | HTMLElement | Svelte — window scroll |
className | string | React only |
class | string | Svelte only |