Components

Night Sky

A twinkling starfield for dark sections. Bright stars drift slightly toward the pointer. Draws a single still frame when the visitor prefers reduced motion.

Customize

density20
dustDensity38
starColor
dustColor
accentColor
accentRatio0.25
parallax14
twinkleSpeed1

Usage

Add NightSky.tsx and color.ts to your project, then render it. The snippet updates with your Customize settings.

Example.tsx
import { NightSky } from './NightSky'

export default function Example() {
  return (
    <section style={{ position: 'relative', overflow: 'hidden', isolation: 'isolate', background: '#0b0e1a' }}>
      <NightSky />
      {/* your content */}
    </section>
  )
}
NameTypeDefaultDescription
densitynumber20Bright-star grid cells across the section's short side. Higher gives more stars.
dustDensitynumber38Faint-star grid cells across the short side.
starColorstring'#ffffff'Colour of the brightest stars.
dustColorstring'#eef0f2'Colour of the faint stars, also used for half of the bright stars.
accentColorstring'#ec4899'Accent colour for a share of the bright stars.
accentRationumber0.25Share of bright stars in the accent colour, 0 to 1.
parallaxnumber14How far bright stars drift toward the pointer, in px. 0 turns drift off.
twinkleSpeednumber1Twinkle speed multiplier.
scaleTonumber—Size the grid as if the short side were this many px. Keeps short, wide sections from looking busier.
classNamestring—Class name for the canvas.

Get Night Sky

Buy this component on its own, or get all three in the Night Sky UI Kit.