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

GhostCursor

ghost-cursor

Shows delayed translucent cursor echoes that follow pointer movement.

Usage

Basic usage

GhostCursor is the decorative covering layer of absolute inset-0, just put it into a dark container of relative + overflow-hidden.

Move the pointer within this area
tsx
<div
  className="relative h-64 overflow-hidden rounded-xl"
  style={{ background: "oklch(0.14 0.02 285)" }}
>
  <GhostCursor />
</div>

Custom color and long tail

color changes the main color, trailLength lengthens the tail, and inertia becomes larger and floats more after stopping.

The tail is longer and more floating
tsx
<GhostCursor
  color="oklch(0.72 0.2 50)"
  trailLength={48}
  inertia={0.78}
/>

Gather small smoke balls

scale The larger the smoke group, the more it gathers. brightness brightens and turns off the particles to be cleaner.

The smoke balls are gathering more
tsx
<GhostCursor
  scale={1.6}
  grainIntensity={0}
  brightness={1.5}
  trailLength={20}
/>

Diffuse soft light

scale The smaller the smoke ball, the more diffuse it is, and the soft ambient light with the main color of green is obtained.

Diffuse soft light
tsx
<GhostCursor
  color="oklch(0.78 0.16 175)"
  scale={0.7}
  inertia={0.6}
  brightness={1.3}
/>

When to Use

Use it as a full-area smoke trail behind a hero, card, or landing-page section. Choose ImageTrail when pointer movement should emit specific images; GhostCursor is an abstract atmospheric light effect. The component is an absolute inset-0 overlay and reads best inside a relatively positioned dark container.

Import

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

Props

NameTypeDefaultDescription
trailLengthnumber32Number of historical pointer positions retained; higher values create a longer trail and increase fragment cost linearly, with 16-64 recommended
inertianumber0.5Inertia from 0 to 1; values near 1 drift farther, while values near 0 track the pointer closely
grainIntensitynumber0.05Film-grain intensity from 0 to 0.3; 0 disables grain
brightnessnumber1.2Overall brightness multiplier; 0.8-2.0 is recommended
colorstringvar(--color-chart-1)Main smoke color; accepts any CSS color and defaults to a theme-aware token
scalenumber1Positive noise-radius factor; higher values spread the smoke and lower values concentrate it
mixBlendModeCSSProperties["mixBlendMode"]"screen"Canvas blend mode; screen creates light on dark backgrounds, while multiply or normal may suit light surfaces
classNamestring-Additional class name for the absolute inset-0 root
styleCSSProperties-Inline styles forwarded to the root, such as zIndex

Usage Guidelines

  • If cleanup calls loseContext during React StrictMode remounting, reusing the canvas can leave it blank. Mount a fresh canvas each time; see [[webgl-canvas-loseContext-poisons-strictmode-remount]].
  • The parent container must be relative + overflow-hidden + dark background (default screen blending mode is almost invisible on light background).
  • WebGL renders only on the client; under reduced motion, the component uses its static fallback.

Related

BorderBeam · ShineBorder · GlareHover · Lens · AnimatedBeam · OrbitingCircles

Playground

Move the pointer within this area
<div className="relative h-64 overflow-hidden rounded-xl"
     style={{ background: "oklch(0.14 0.02 285)" }}>
  <GhostCursor
    trailLength={32}
    inertia={0.5}
    brightness={1.2}
    grainIntensity={0.05}
    scale={1}
  />
</div>
PreviousElectricBorderDecorationNextGradualBlur

On this page

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