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

Prism

prism

Raymarches a refractive octahedral prism that casts volumetric rainbow light.

Usage

Basic usage

is placed in the relative overflow-hidden container. The component comes with absolute inset-0 z-0; the content is stacked on top with relative z-10.

Prism

tsx
<div className="relative h-64 overflow-hidden rounded-xl"
     style={{ background: "oklch(0.11 0.02 275)" }}>
  <Prism />
  <div className="relative z-10 flex h-full items-center justify-center">
    <p className="text-2xl font-bold text-white/90">Prism</p>
  </div>
</div>

Animation mode

animationType Choose one of three: rotate (breathing swing) / 3drotate (three-dimensional rotation) / hover (follow the pointer).

3D Rotation

tsx
<Prism animationType="3drotate" glow={1.2} />

High Glow·Purity

glow brightens volumetric light, noise=0 removes film grain and obtains a clean and transparent light spectrum.

High Glow · Pure

tsx
<Prism animationType="3drotate" glow={1.6} bloom={1.3} noise={0} />

Product Hero

Use offset to move the prism up to avoid the title, and layer a top halo to create a decorative background for the first marketing screen.

A beam of light refracts the entire spectrum

Enterprise component library · WebGL decorative background

tsx
<div className="relative h-64 overflow-hidden rounded-xl"
     style={{ background: "oklch(0.09 0.025 270)" }}>
  <Prism
    animationType="3drotate"
    glow={1.3}
    scale={4.2}
    offset={{ x: 0, y: -40 }}
    colorFrequency={1.2}
  />
  <div className="relative z-10 flex h-full flex-col items-center justify-center gap-3 px-8">
    <h1 className="text-3xl font-bold text-white">A beam of light, refracting the entire spectrum</h1>
    <p className="text-sm text-white/50">Enterprise-level component library · WebGL decorative background</p>
  </div>
</div>

When to Use

Use Prism as a single sculptural focal point in a product hero or brand composition. Its offset, scale, and transparent canvas make room for adjacent copy without changing the surrounding layout. Choose PrismaticBurst for light radiating across the full frame, or Plasma and PlasmaWave for continuous surface texture.

Import

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

Props

NameTypeDefaultDescription
heightnumber3.5Prism height along the Y axis; increasing it produces a taller, narrower silhouette
baseWidthnumber5.5Width of the prism base; use it with height to control the silhouette's proportions
animationType"rotate" | "3drotate" | "hover""rotate"rotate oscillates the base in the XZ plane, 3drotate applies organic three-axis motion, and hover tilts toward the global pointer with inertia
glownumber1Volumetric-light strength; 0 leaves a dark outline
offset{ x?: number; y?: number }{ x: 0, y: 0 }Translation from the viewport center in CSS pixels, useful for balancing the prism beside foreground content
noisenumber0.5Film-grain strength; 0 renders a clean image
transparentbooleantruePreserve canvas alpha so the parent background shows through; this mode also raises saturation internally
scalenumber3.6Overall prism scale; higher values occupy more of the viewport
hueShiftnumberDerived from --color-chart-1Hue rotation in radians; an explicit value replaces the theme-derived hue
colorFrequencynumber1Spectral-band frequency; higher values create denser bands and lower positive values create wider bands. The current runtime normalizes 0 to 1.
hoverStrengthnumber2Maximum pointer-driven tilt in hover mode. The current runtime normalizes 0 to 1.
inertianumber0.05Pointer interpolation factor from 0 to 1; lower positive values ease for longer and higher values track more directly. The current runtime normalizes 0 to 0.12.
bloomnumber1Brightness multiplier applied together with glow. The current runtime normalizes 0 to 1.
timeScalenumber0.5Overall animation-speed multiplier. The current runtime normalizes 0 to 1 rather than freezing the frame.
classNamestring-Class name forwarded to the root container or reduced-motion fallback

Slots

SlotTypeDescription
fallbackReactNodeDecorative content rendered inside the static chart-token radial glow when reduced motion is enabled; the fallback root is aria-hidden

Usage Guidelines

  • Prism is an absolute inset-0 z-0 decorative layer. Give its parent position: relative, explicit dimensions, and clipping as needed; place foreground content at relative z-10 or above. See [[webgl-canvas-rendered-but-invisible-negative-zindex-covered]].
  • animationType="hover" follows the global pointer, not just movement within the container. Only this mode installs pointer listeners; rotate and 3drotate ignore pointer movement.
  • During SSR, the live root has no canvas. After hydration, a canvas is appended before OGL import and scene setup; if either step fails, that uninitialized or blank canvas remains and Prism does not switch to the reduced-motion fallback. Reduced motion instead renders the static radial glow plus decorative fallback content.
  • When hueShift is omitted, the base hue is derived from --color-chart-1 through an off-screen canvas. An explicit hueShift replaces that derived value. Theme variables must use the --color- prefix. See [[oklch-css-var-color-must-parse-via-offscreen-canvas]].
  • Throttled animation frames can make headless screenshots appear static or empty. Verify rotation on a real device or with Playwright frame measurements; see [[recharts-headless-screenshot-blank-clippath-animation-starved]].

Related

DotPattern · GridPattern · StripedPattern · Spotlight · RetroGrid · Ripple

Playground

Prism · WebGL Background

<div className="relative h-64 overflow-hidden rounded-xl"
     style={{ background: "oklch(0.11 0.02 275)" }}>
  <Prism
    animationType="rotate"
    glow={1}
    scale={3.6}
    noise={0.5}
    timeScale={0.5}
  />
  <div className="relative z-10">Content</div>
</div>
PreviousPlasmaWaveDecorationNextPrismaticBurst

On this page

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