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

GlassSurface

glass-surface

Creates a refractive glass surface with chromatic edge dispersion and fallback blur.

Usage

Basic usage

A liquid glass pill that refracts + disperses the content behind it. It needs to be placed on a rich colorful background to see the effect clearly.

Glass Surface
tsx
<GlassSurface width={220} height={90} borderRadius={24}>
  <span className="text-sm font-semibold text-foreground">
    Glass Surface
  </span>
</GlassSurface>

Strong dispersion

By enlarging distortionScale and each channel offset, a more obvious RGB split light edge appears on the edge of the glass.

Hulian
tsx
<GlassSurface
  width={240}
  height={100}
  borderRadius={28}
  distortionScale={-220}
  greenOffset={25}
  blueOffset={45}
>
  <span className="text-sm font-semibold text-foreground">Hulian</span>
</GlassSurface>

Matte bottom

backgroundOpacity increases the opacity of the glass background color, and works with saturation to create a more solid frosted texture.

Frosted
tsx
<GlassSurface
  width={220}
  height={90}
  borderRadius={20}
  backgroundOpacity={0.5}
  saturation={1.4}
>
  <span className="text-sm text-foreground">Frosted</span>
</GlassSurface>

Round badge

Equal width and height + borderRadius Take the radius to get a circular glass badge.

Hu
tsx
<GlassSurface width={96} height={96} borderRadius={48}>
  <span className="text-xl font-bold text-foreground">hu</span>
</GlassSurface>

When to Use

Use it for a fixed-size pill, card, or button surface that visibly refracts the background and separates RGB edges. Use FluidGlass for a full-screen, pointer-following effect or Lens for local magnification. GlassSurface uses an SVG displacement map, so place it over detailed content where refraction is visible.

Import

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

Props

NameTypeDefaultDescription
widthnumber | string200Width, number is treated as px, string is passed through as it is
heightnumber | string80Height, number is treated as px, string is passed through as it is
borderRadiusnumber20Fillet radius px, acting on the inner rectangle of the container and displacement map at the same time
borderWidthnumber0.07Edge highlight band width coefficient 0~1 (relatively short side), the larger the wider the refraction
brightnessnumber50Displacement map internal rectangular brightness (HSL's L, 0~100), control glass thickness texture
opacitynumber0.93Displacement map internal rectangle opacity 0~1
blurnumber11Displacement map internal rectangular Gaussian blur radius px, softening the refraction boundary
displacenumber0Refraction result quadratic Gaussian blur, eliminate pixel aliasing
backgroundOpacitynumber0Frosted background opacity, 0=fully transparent
saturationnumber1backdrop-filter saturation magnification
distortionScalenumber-180Refraction displacement; negative values indent, positive values bulge, and channel offsets add chromatic separation
redOffsetnumber0The extra displacement (color difference) of the red channel relative to distortionScale
greenOffsetnumber10Green channel additional displacement (color difference)
blueOffsetnumber20Blue channel additional displacement (color difference)
xChannelGlassChannel"R"X-direction offset access channel ("R"|"G"|"B"|"A")
yChannelGlassChannel"G"Y-direction offset access channel
mixBlendModeCSSProperties["mixBlendMode"]"difference"Red/blue gradient overlay blending mode in the displacement map (determines the refraction texture shape)
classNamestring-Root container className
styleCSSProperties-Forward the root container inline style

Slots

SlotTypeDescription
childrenReactNodeGlass surface content (centered above the refractive layer)

Usage Guidelines

  • Refraction relies on SVG feDisplacementMap to shift background pixels. The effect is almost invisible on a solid color/blank background. It must be placed on a background with gradients/textures/images.
  • Browsers that do not support SVG filters will fall back to backdrop-blur (no dispersion); this is a built-in downgrade of the component, not a bug.
  • Client-side components (relying on runtime SVG filters and pointers), only static shells are available under SSR, and interactive states must be verified in the browser.
  • Turn off transition animation in reduced-motion (refraction itself is still there).

Related

BorderBeam · ShineBorder · GlareHover · Lens · AnimatedBeam · OrbitingCircles

Playground

Glass
<GlassSurface
  width={220}
  height={90}
  borderRadius={24}
  distortionScale={-180}
  blueOffset={20}
  backgroundOpacity={0}
>
  Glass
</GlassSurface>
PreviousGlassIconsDecorationNextLanyard

On this page

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