Skip to content
IndexRequest a UIAboutContact

Liquid Glass Button

A translucent glass button whose highlight follows the pointer and which squishes when pressed.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Create a glass button on a soft colourful background (blurry indigo, coral and mint shapes). The button is a 48px tall pill with backdrop-filter blur(14px) saturate(1.4), a rgba(255,255,255,0.28) fill, a 1px rgba(255,255,255,0.7) border and an inset highlight (inset 0 1px 0 rgba(255,255,255,.8)). Add a radial-gradient highlight layer positioned with CSS custom properties --x and --y set from pointermove (percent of the button) at 45 percent white opacity that fades in on hover. On press scale to 0.96 in 140ms cubic-bezier(.3,1.4,.5,1) and darken the tint. The label is 14px semibold dark text with strong contrast. Keep a 2px focus-visible ring outside the border. Track the pointer only for mouse or pen. Under prefers-reduced-motion disable tracking and scaling and use only a tint change. Provide a solid white fallback with @supports not (backdrop-filter: blur(1px)).

About this pattern

Definition

A button made of blurred, translucent material with a thin bright edge and a soft highlight that moves toward the pointer. Pressing it compresses it slightly, as if it were a physical, slightly elastic object.

Purpose & UX principles

  • Gives controls a tactile, material presence on rich backgrounds such as photos and gradients.
  • Legibility comes first: the label sits on a tint strong enough for 4.5:1 contrast, and the effect never carries meaning on its own.
  • Provide a solid fallback where backdrop blur is unavailable.

Interaction states

  • Rest, hover (highlight follows the pointer, edge brightens), pressed (scale 0.96 and a darker tint), focus-visible (outer ring), disabled.

Motion specification

  • The highlight position updates every frame; scale on press 140ms cubic-bezier(.3,1.4,.5,1).
  • Reduced motion: no highlight tracking and no scale, only a tint change.

Responsive behaviour

  • 48px tall, at least 120px wide; the highlight effect is pointer-only and disabled on touch.
  • The effect is cheap: only custom properties change.

Code

HTML
<div class="bg"><i class="b1"></i><i class="b2"></i><i class="b3"></i><button class="gb" id="gb"><span class="hl"></span><span class="lb">Continue</span></button></div>

Related patterns

Frosted Glass & Acrylic

↗
Frosted Glass & AcrylicSurfaces & Objects

Press Feedback

↗
Press FeedbackButtons & Actions

Magnetic Button

↗
Magnetic ButtonButtons & Actions