Glassmorphism
PaletteComponentsAI RulesDo / Don'tPhilosophy
← StyleKit
玻璃拟态 — Glassmorphism

See Through.
Layers Deep.

Half-transparent panels, backdrop blur, and luminous edges create a modern depth that feels like frosted glass catching light.

backdrop-blur
Core Effect
bg-white/20
Glass Base
border/25
Edge Glow
shadow-xl
Depth Layer
Foundation

Gradient backgrounds

Glassmorphism requires a rich gradient background. The glass effect only emerges when there is something vibrant behind it to blur and refract.

Small Panel
Glass panel 1
Main Content
Glass panel 2
Side Panel
Glass panel 3
Palette

Glass color system

Two transparent glass layers and four gradient accent colors compose the entire palette. With glassmorphism, the transparency is the color.

Glass White
#FFFFFF40
Primary glass layer
Subtle Glass
#FFFFFF2E
Secondary glass layer
Violet Depth
#667eea
Accent gradient start
Royal Purple
#764ba2
Accent gradient mid
Pink Mist
#f093fb
Accent gradient end
Crimson Glow
#f5576c
Highlight accent

Recommended gradient combinations

Purple Pink
Blue Purple
Sunset Rose
Components

Glass building blocks

Every component is a glass panel. Half-transparent, blurred, bordered with luminous edges. Hover triggers an optical glint sweep across the surface.

Primary — Glass button with optical glint

Size variants

State variants

AI Rules

Interaction rules demo

Four named interaction rules define how glassmorphism elements behave. Interact with each demo to feel the optical physics in action.

Rule 1: Optical Glint

A tilted gradient highlight sweeps once across the glass surface, simulating light refraction through a real pane of glass. Never loops — single pass only.

-translate-x-[140%] skew-x-[-24deg]
group-hover:translate-x-[140%] duration-700

Click the button to see the Optical Glint animation

Rule 2: Floating Depth

Hover lifts the element with a slight translateY and expands the shadow, simulating the panel floating closer to the viewer through the glass layers.

hover:-translate-y-0.5 to hover:-translate-y-2
shadow expands proportionally with lift
Toggle to compare
Panel 1
-2px lift
Panel 2
-4px lift
Panel 3
-6px lift
Panel 4
-8px lift

Hover each panel to see depth lift

Rule 3: Edge Illumination

Border opacity increases from white/20 to white/70+ on interaction, simulating a glass edge catching direct light. Paired with a white glow shadow.

border-white/20 → border-white/45 → white/72
box-shadow glow expands with border brightness
Glass Panel
Border opacity: 20%
Glow: none

Switch levels to see border brightness change

Rule 4: Smooth Translucency

All transitions use duration-300 with ease-out for silky optical changes. Opacity shifts feel like light passing through — never abrupt.

transition-all duration-300 ease-out
bg-white/{opacity} — drag slider to see live
Glass opacity20%
5% (too thin)20% (ideal)45% (opaque)
Live Glass Preview
Ideal range — balanced depth and readability
Architecture

Layer depth system

Glassmorphism is built from four stacked layers. Click each tab to see what each layer contributes to the final frosted glass effect.

Gradient Background

The colorful foundation

1

Background Gradient

Rich multi-stop gradient forms the colorful foundation. Without this layer, there is nothing for the blur to sample — the glass effect collapses.

bg-gradient-to-br from-[#667eea] via-[#764ba2] to-[#f093fb]
App Demo

Glass in the wild

Three real-world patterns showing glassmorphism applied to login, weather, and analytics UI. All panels use backdrop-blur over the gradient.

Login
Welcome back
Sign into your account
No account? Register
Weather
24°
Partly Cloudy
San Francisco, CA
Mon
19°
Tue
21°
Wed
23°
Humidity
68%
Wind
12km/h
Analytics
Dashboard
Last 30 days
Total Users12,840
Revenue$48,200
Conversions3.8%
Retention91%
Rules

Do & Don't

Glassmorphism has strict requirements. Breaking these rules destroys the illusion — the effect collapses into muddy, unreadable transparency.

Do

  • Use semi-transparent backgrounds bg-white/10 to bg-white/30
  • Always add backdrop-blur-md or backdrop-blur-xl
  • Use subtle borders border border-white/20
  • Add soft diffuse shadows shadow-lg or shadow-xl
  • Use gradient backgrounds as the base layer bg-gradient-to-br
  • Use moderate rounded corners rounded-xl or rounded-2xl
  • Ensure high contrast text for readability on frosted surfaces
  • Add optical glint sweep on interaction — single pass, no loop

Don't

  • Never use glass on pure white or solid color backgrounds
  • Never omit backdrop-blur — it is the core effect
  • Never make panels so transparent content becomes unreadable
  • Never use hard-edge shadows shadow-[Xpx_Xpx_0px]
  • Never use opaque backgrounds bg-white or bg-black
  • Never use sharp corners rounded-none
  • Never use low-contrast text on low-contrast glass
  • Never loop the glint animation — single sweep only, no flicker
Philosophy

Design principles

Four core principles from iOS and macOS design language define how glassmorphism creates spatial depth without physical weight.

Hierarchy through transparency

Depth without opacity

Layers are distinguished by their transparency level. Front panels use bg-white/20, back panels bg-white/10. The closer a panel is to the viewer, the more defined its glass properties.

bg-white/10 → bg-white/20 → bg-white/30

Modern high-tech atmosphere

Blur creates premium

backdrop-blur-md and backdrop-blur-xl signal quality and modernity. The blurred background beneath each panel implies depth and the sense that you are floating above rich content.

backdrop-blur-md, backdrop-blur-xl

Visual lightness

Transparency reduces weight

Semi-transparent elements feel lighter than their opaque counterparts. The eye perceives them as floating rather than sitting — creating an airy, modern interface feel.

shadow-[0_8px_32px_rgba(0,0,0,0.1)]

Spatial depth

Soft shadows add dimension

Soft diffuse shadows without hard edges create the final dimension. The shadow tells the eye that the panel exists above the background — it is floating in three-dimensional space.

shadow-lg, shadow-xl, shadow-2xl

Layer architecture — required stacking order

1. Bottom
Gradient or image background (required — glass needs something rich to blur)
bg-gradient-to-br
2. Middle
Glass container — backdrop-blur + bg-white/10 to /30 + border-white/20
backdrop-blur-xl
3. Top
Content elements — text-white, icons, inputs, buttons
text-white
Glassmorphism

Half-transparent frosted glass panels, backdrop blur, and luminous borders creating modern depth inspired by iOS and macOS design.

StyleDocumentationShowcaseCover
StyleKitHomeAll Styles
Core Valuesbackdrop-blurbg-white/20border-white/25shadow-xl
Glassmorphism showcase for StyleKit
Back to StyleKit