23rd logo23rd

Radiant Lines

A hyperspace starfield background where scroll speed drives the warp.

Installation

pnpm dlx shadcn@latest add @23rd/radiant-lines

Or from the public GitHub registry:

pnpm dlx shadcn@latest add radiumcoders/23rd.dev/radiant-lines

Usage

Pass the scroll container if the page scrolls inside an element, not 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

PropTypeDefault
colorsstring[]coral / teal / amber / blue / pink / lime / slate, deeper on light pages
theme"light" | "dark" | "auto""auto"
starCountnumber420
displacementnumber1, star jump on warp
containerRefRefObject<HTMLElement | null>window scroll
classNamestringnone