# LiquidGlass

> Glass-like visual effect using SVG filters for chromatic displacement.

- Package: `fancy-ui-vue` (Vue 3.5+ + Tailwind CSS v4)
- Category: Effects
- Tags: glass, effect, svg, filter, chromatic, displacement, blur
- Types: `LiquidGlassProps`
- Docs: https://fancy-ui.rama.app/docs/components/liquid-glass
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/vue/src/components/liquid-glass

## Import

```vue
<script setup lang="ts">
import { LiquidGlass } from 'fancy-ui-vue';
</script>
```

Setup (once per project): `npm install fancy-ui-vue`, then put these lines in your main CSS file (the stylesheet imports go right after `@import "tailwindcss";`):

```css
@import "tailwindcss";
@import "fancy-ui-vue/tailwind.css";
@import "fancy-ui-vue/styles.css";
```

Full guide: https://fancy-ui.rama.app/llms.txt

The names below are the ones to write in a Vue template; when one differs from the Svelte name, the Svelte name follows in parentheses. Snippets become named slots (`#default` is the default snippet), a prop the Vue port declares as a model is a `v-model:<name>` (except `ref`, exposed via `defineExpose({ ref })`: put a template ref on the component and read `.ref`) and callbacks are listeners (`onclick` is `@click`). Every component sets `inheritAttrs: false`: `class` is a declared prop, merged where the Svelte component applies it (not always the root element), and only when the props table below lists it; other attributes do not fall through unless the package README lists the component as forwarding native attributes. Divergences: https://github.com/RamaHerbin/fancy-ui/tree/main/vue#divergences-from-the-svelte-api

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `radius` | `number` | `16` | Border radius in pixels |
| `border` | `number` | `0.07` | Border thickness as fraction of min dimension |
| `lightness` | `number` | `50` | Background lightness percentage |
| `displace` | `number` | — | Optional Gaussian blur on the displacement output |
| `blend` | `string` | `"difference"` | SVG blend mode for the displacement channels |
| `xChannel` | `"R" \| "G" \| "B"` | `"R"` | X displacement channel selector |
| `yChannel` | `"R" \| "G" \| "B"` | `"B"` | Y displacement channel selector |
| `alpha` | `number` | `0.93` | Background fill alpha |
| `blur` | `number` | `11` | Blur applied to the background fill layer |
| `rOffset` | `number` | `0` | Red channel displacement offset |
| `gOffset` | `number` | `10` | Green channel displacement offset |
| `bOffset` | `number` | `20` | Blue channel displacement offset |
| `scale` | `number` | `-180` | Displacement scale |
| `frost` | `number` | `0.05` | Frosted glass opacity |
| `fallbackBlur` | `number` | `20` | Backdrop blur in pixels for the Safari fallback |
| `fallbackSaturation` | `number` | `180` | Backdrop saturation percentage for the Safari fallback |
| `containerClass` | `string` | `""` | CSS classes for the outer container |

## Slots

| Slot | Description |
| --- | --- |
| `#default` (Svelte `children`) | Content rendered inside the glass effect |

## Example

```vue
<script setup lang="ts">
import { LiquidGlass } from "fancy-ui-vue";
</script>

<template>
	<div
		class="relative flex h-[400px] w-full items-center justify-center overflow-hidden rounded-lg border"
	>
		<div
			class="absolute top-1/4 left-1/4 h-72 w-72 -translate-x-1/2 -translate-y-1/2 rounded-full bg-violet-500/30 blur-3xl"
		/>
		<div class="absolute right-1/4 bottom-1/3 h-64 w-64 rounded-full bg-cyan-500/30 blur-3xl" />
		<div
			class="absolute bottom-1/4 left-1/2 h-56 w-56 -translate-x-1/2 rounded-full bg-rose-500/25 blur-3xl"
		/>

		<div class="relative z-10">
			<LiquidGlass :radius="20" :frost="0.05">
				<div
					class="text-foreground flex min-h-16 w-full items-center justify-center px-12 py-4 text-base font-medium"
				>
					Liquid Glass
				</div>
			</LiquidGlass>
		</div>
	</div>
</template>
```
