Skip to content

Getting Started

This project draws inspiration and ideas from Chris Feijoo's article Liquid Glass in the Browser: Refraction with CSS and SVG.

Browser compatibility: The Liquid Glass effect relies on SVG filters as backdrop-filter, which is currently only supported in Chromium-based browsers (Chrome, Edge, Opera, etc.). For unsupported browsers, a glassmorphism blur fallback is applied automatically.

Installation

Install the package via your preferred package manager:

bash
pnpm add liqvued
bash
npm install liqvued
bash
yarn add liqvued

Global Registration

Register the plugin globally in your app entry point:

ts
import { createApp } from 'vue'
import LiqvuedPlugin from 'liqvued'
import App from './App.vue'

const app = createApp(App)
app.use(LiqvuedPlugin)
app.mount('#app')

Now the <Liqvued> component is available anywhere in your templates.

Local Import

You can also import the component locally in individual SFCs:

vue
<script setup lang="ts">
import { Liqvued } from 'liqvued'
</script>

<template>
  <Liqvued :radius="32" :bezel="22" :thickness="42" :refraction="1" :blur="0.4" surface="convex">
    <p>Your content here</p>
  </Liqvued>
</template>

Basic Usage

Wrap any content in <Liqvued> and place it over a background to see the refraction effect:

⚡ Your browser doesn't support the Liquid Glass SVG effect.
A glassmorphism blur fallback is applied instead.

Liquid Glass

Refraction & Specular Effects

Surface
Blur 0.8
Thickness 60
Refraction 1.6
Bezel 36
Magnification 0.0
Magnification Focus 0.82
Enable Effects
vue
<script setup lang="ts">
import { Liqvued } from 'liqvued'
</script>

<template>
  <div
    style="background: url('https://picsum.photos/seed/liqvued/1200/600') center/cover;"
  >
    <Liqvued
      :bezel="45"
      :thickness="60"
      :refraction="3"
      :glare-angle="285"
      :specular-opacity="0.2"
      glass-background="#00f0f055"
      :blur="0.8"
      surface="convex"
    >
      <h2>Hello from behind the glass</h2>
    </Liqvued>
  </div>
</template>

The glass effect is driven by two key primitives:

  • SVG <feDisplacementMap> — refracts the background based on the surface profile
  • CSS backdrop-filter: blur() — adds frosted glass blur

A per-pixel displacement map is generated on a Canvas, encoded as a PNG data URL, and injected into the SVG filter via <feImage>.

Surface Types

TypeDescriptionAppearance
convexSquircle convex profileSoft, pill-like edges with inward refraction
concaveInverted convex profileInward-curving dish-like refraction
lipSmooth convex-to-concave transitionS-curve that lifts at center and dips at edges
bowlDeeper concave profileBroader inward dish effect
bevelLinear edge rampHarder, cleaner faceted-looking edge refraction
saddleMirrored S-curveDirection change through the middle of the edge band
rippleWave-modulated profileRepeating small undulations across the edge band
noiseIrregular deterministic profileOrganic, uneven glass distortion
asymmetricBiased convex profileUneven weighting that shifts the perceived edge pull

Props

PropTypeDefaultDescription
asstring | Component'div'HTML tag or Vue component to render as (rendered as a child of the glass root)
asPropsobject{}Props passed to the rendered element/component
radiusnumber32Corner radius in pixels
borderRadiusstringPer-corner border-radius CSS value (e.g. "10px 20px 10px 20px"); overrides radius
bezelnumber22Width of the displacement bezel in pixels
thicknessnumber42Maximum displacement magnitude in pixels
refractionnumber1Refraction index multiplier
magnificationnumber0Center magnification amount. Positive values enlarge, negative values shrink
magnificationFocusnumber0.82Focus radius of the magnification area. Lower values keep the effect tighter
blurnumber0.4CSS backdrop-filter blur amount
surfaceSurface'convex'Surface profile shape
specularOpacitynumber0.45Opacity of the specular highlight
glareAnglenumber-60Light source angle in degrees for specular highlight
glassBackgroundstringGlass panel background color (auto-derived from asProps.color when available)
fallbackOnlybooleanfalseWhen true, disables the SVG displacement effect and uses only CSS blur

MIT Licensed