Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Backgrounds

  • DotPattern
  • GridPattern
  • StripedPattern
  • Spotlight
  • FadeMask
  • RetroGrid
  • Ripple
  • Meteors
  • Aurora
  • Particles
  • FlickeringGrid
  • WavyBackground
  • Silk
  • Iridescence
  • Threads
  • Orb
  • LiquidChrome
  • Balatro
  • Ballpit
  • Beams
  • ColorBends
  • DarkVeil
  • Dither
  • DotField
  • EvilEye
  • FaultyTerminal
  • Ferrofluid
  • FloatingLines
  • Galaxy
  • GradientBlinds
  • Grainient
  • GridDistortion
  • GridMotion
  • GridScan
  • Hyperspeed
  • LetterGlitch
  • Lightfall
  • Lightning
  • LightPillar
  • LightRays
  • LineWaves
  • LiquidEther
  • PixelBlast
  • PixelSnow
  • Plasma
  • PlasmaWave
  • Prism
  • PrismaticBurst
  • Radar
  • RippleGrid
  • ShapeGrid
  • SideRays
  • SoftAurora

Overlay Effects

  • BorderBeam
  • ShineBorder
  • GlareHover
  • Lens
  • AnimatedBeam
  • OrbitingCircles
  • ProgressiveBlur
  • CardSpotlight
  • Reveal
  • Antigravity
  • BlobCursor
  • ClickSpark
  • Crosshair
  • ElectricBorder
  • GhostCursor
  • GradualBlur
  • ImageTrail
  • LaserFlow
  • MagicRings
  • Magnet
  • MagnetLines
  • MetaBalls
  • MetallicPaint
  • OrbitImages
  • PixelTrail
  • PixelTransition
  • Ribbons
  • ShapeBlur
  • SplashCursor
  • StarBorder
  • StickerPeel
  • TargetCursor
  • Cubes
  • Tilt
  • BorderGlow
  • GlassIcons
  • GlassSurface
  • Lanyard
  • ModelViewer
  • FluidGlass

Galaxy

galaxy

Builds a multilayer parallax star field with twinkle, rotation, and pointer repulsion.

Usage

Basic usage

Put it into the relative container and it will be filled. The component comes with absolute inset-0 z-0; the content is placed in z-10.

Content layer
tsx
<div className="relative h-64 overflow-hidden rounded-xl bg-neutral-950">
  <Galaxy />
  <div className="relative z-10 flex h-full items-center justify-center text-white/80">
    Content layer
  </div>
</div>

Color correction: Hue + Saturation

hueShift rotates the main color, and saturation increases it to make the star points appear colorful.

tsx
<Galaxy hueShift={300} saturation={0.4} density={1.4} glowIntensity={0.4} />

Central star ring

autoCenterRepulsion > 0 When the star point is repelled outward from the center, it forms the appearance of a star ring in the center of the hollow.

tsx
<Galaxy autoCenterRepulsion={2} density={1.2} hueShift={200} mouseInteraction={false} />

Pure decorative wallpaper (turn off interaction)

mouseInteraction={false} allows click penetration, suitable for static background.

tsx
<Galaxy
  rotationSpeed={0.05}
  glowIntensity={0.5}
  twinkleIntensity={0.6}
  starSpeed={0.3}
  mouseInteraction={false}
/>

When to Use

Use it for a deep-space backdrop behind a hero, launch screen, or large dashboard. Use Ferrofluid for liquid metal, DotPattern for a static dot matrix, or Spotlight for a single pointer focus. Galaxy emphasizes layered parallax, twinkling stars, and pointer repulsion.

Import

ts
import { Galaxy } from "@hulianui/ui"

Props

NameTypeDefaultDescription
focal[number, number][0.5, 0.5]Normalized convergence point and center of the galaxy's spread
rotation[number, number][1, 0]View rotation as a cosine/sine vector; [0.707, 0.707] is approximately 45 degrees
starSpeednumber0.5Star-drift speed multiplier
densitynumber1Star density; 0.5 is sparse and 2 is dense
hueShiftnumber140Hue offset from 0 to 360; the default produces cyan highlights
speednumber1Overall drift and twinkle speed multiplier
mouseInteractionbooleantrueEnables galaxy offset or repulsion on pointer movement
glowIntensitynumber0.3Star-glow intensity
saturationnumber0Color saturation; 0 keeps stars nearly white, while higher values reveal hueShift
mouseRepulsionbooleantruePushes stars away when true or translates the whole field when false; requires mouseInteraction
repulsionStrengthnumber2Pointer repulsion strength, only effective when mouseRepulsion=true
twinkleIntensitynumber0.3Star point flashing intensity, 0=no flashing
rotationSpeednumber0.1Galaxy automatic rotation speed, 0 = no rotation
autoCenterRepulsionnumber0Automatic repulsion from the center; values above 0 open a central cavity surrounded by stars
transparentbooleantruePreserve alpha so the container background shows through; false renders a solid black deep-space background
classNamestring-Root container (or div)

Slots

SlotTypeDescription
fallbackReactNodeStatic non-WebGL content for SSR, reduced motion, or unavailable WebGL; defaults to a radial gradient

Usage Guidelines

  • OGL/WebGL renders on the client with lazy loading and StrictMode-safe cleanup. SSR and unavailable WebGL show the radial-gradient fallback.
  • Place the root in a relative overflow-hidden container with an explicit height such as h-64.
  • With transparent={true}, add a dark container background for a deep-space look. Use transparent={false} for a built-in solid black background.
  • mouseRepulsion and repulsionStrength take effect only when mouseInteraction=true.

Related

DotPattern · GridPattern · StripedPattern · Spotlight · RetroGrid · Ripple

Playground

<div className="relative h-64 overflow-hidden rounded-xl"
     style={{ background: "oklch(0.12 0.02 265)" }}>
  <Galaxy
    density={1}
    hueShift={140}
    glowIntensity={0.3}
    twinkleIntensity={0.3}
    mouseInteraction={true}
  />
</div>
PreviousFloatingLinesDecorationNextGradientBlinds

On this page

  • Usage
  • Documentation
    • When to Use
    • Import
    • Props
    • Slots
    • Usage Guidelines
    • Related
  • Playground