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

MetaBalls

meta-balls

Blends moving metaballs into a fluid interactive shader surface.

Usage

Basic usage

The dark container is covered with absolute inset-0, and a group of slime balls swim around and merge with the pointer.

tsx
<div className="relative h-64 overflow-hidden rounded-xl"
     style={{ background: "oklch(0.14 0.02 255)" }}>
  <MetaBalls className="absolute inset-0" />
</div>

Intensive group gathering

Increase ballCount and tighten clumpFactor to make the balls denser and closer.

tsx
<MetaBalls
  className="absolute inset-0"
  ballCount={28}
  clumpFactor={0.7}
  speed={0.5}
/>

Custom color matching

color and cursorBallColor are mixed with chart and token with the prefix --color-.

tsx
<MetaBalls
  className="absolute inset-0"
  color="var(--color-chart-3)"
  cursorBallColor="var(--color-chart-5)"
  animationSize={40}
/>

Turn off mouse interaction

When enableMouseInteraction=false, the cursor ball automatically performs an elliptical tour.

tsx
<MetaBalls
  className="absolute inset-0"
  enableMouseInteraction={false}
  speed={0.25}
/>

When to Use

Use MetaBalls for an organic liquid-light background whose blobs merge, split, and follow the pointer, such as a hero, card surface, or loading screen. For edge refraction, use ShapeBlur or Lens; for icons on a regular orbit, use OrbitingCircles. MetaBalls reads best on a dark background.

Import

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

Props

NameTypeDefaultDescription
colorstring"var(--color-chart-1)"The filling color when the main ball is aggregated. Feed token must be prefixed with --color-
cursorBallColorstring"var(--color-chart-4)"Cursor ball color, mixed with color at the junction
speednumber0.3Revolution speed multiplier, the larger it is, the faster it will travel
enableMouseInteractionbooleantrueEnable mouse interaction; when turned off, the cursor ball will automatically travel around the ellipse
hoverSmoothnessnumber0.05Cursor-ball interpolation coefficient (0-1); lower values produce more lag, while higher values follow more closely
animationSizenumber30Observation scale, the larger the field of view, the smaller the balls and the more scattered they are
ballCountnumber15Number of main balls (1-50, beyond clamping to 50)
clumpFactornumber1Clumping factor; higher values spread the orbit, while lower values keep the balls tighter
cursorBallSizenumber3Cursor ball radius (shader units)
enableTransparencybooleantrueTransparent background; fill in black background when false
classNamestring-Passthrough to canvas / fallback container

Slots

SlotTypeDescription
fallbackReactNodereduced-motion / custom static fallback content without WebGL

Usage Guidelines

  • The token color given to color / cursorBallColor must be prefixed with --color- (var(--color-chart-1)). In this Tailwind v4 system the bare var(--primary) is not a defined variable, so the component falls back to a neutral grey — neither the color you asked for nor black. See [[hulian-token-color-var-needs-color-prefix]].
  • Colors are resolved once at mount and written into a shader uniform. Switching theme ([data-theme]) at runtime does not recompute them — pass a theme-derived key to force a remount if you need them to follow the theme.
  • WebGL/ogl component, client-side rendering only; when placed in the RSC page, note that it is "use client". Canvas context reuse under StrictMode dual mounting may be poisoned, refer to [[webgl-canvas-loseContext-poisons-strictmode-remount]].
  • The parent container needs relative + overflow-hidden, and the component should be filled with absolute inset-0; it is recommended that the background color be dark to see the glowing sticky ball clearly.

Related

BorderBeam · ShineBorder · GlareHover · Lens · AnimatedBeam · OrbitingCircles

Playground

<div className="relative h-64 overflow-hidden rounded-xl"
     style={{ background: "oklch(0.14 0.02 255)" }}>
  <MetaBalls
    className="absolute inset-0"
    speed={0.3}
    ballCount={15}
    animationSize={30}
    clumpFactor={1}
    enableMouseInteraction={true}
  />
</div>
PreviousMagnetLinesDecorationNextMetallicPaint

On this page

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