Browse docsSurface

Surfaces

Glass Surface

The glass material on its own: frost, rim light and refraction for your own components.

pnpm dlx shadcn@4.14.1 add @glassyui/glass-surface

Preview

Demos ready. Update 0.

Installation

First add the exact @glassyui mapping to components.json as shown in Getting Started. Then run the pinned item command:

Install Glass Surface

pnpm dlx shadcn@4.14.1 add @glassyui/glass-surface
What this installs9 files, 1 package

Direct registry declarations

These values belong to @glassyui/glass-surface itself in registry.json.

Package dependencies

  • clsx

Registry dependencies

  • @glassyui/glass-provider

File targets

  • components/glassyui/glass-surface.tsx
  • components/glassyui/lib/merge-refs.ts
  • components/glassyui/lib/refraction-map.ts
  • components/glassyui/lib/use-refraction-filter.tsx
  • components/glassyui/lib/scene-context.ts

Complete installed closure

This follows every namespaced registry dependency recursively and de-duplicates the packages and target files installed with this item.

Package dependencies

  • clsx

Installed files

  • components/glassyui/glass-surface.tsx
  • components/glassyui/lib/merge-refs.ts
  • components/glassyui/lib/refraction-map.ts
  • components/glassyui/lib/use-refraction-filter.tsx
  • components/glassyui/lib/scene-context.ts
  • components/glassyui/glass-provider.tsx
  • components/glassyui/liquid-filters.tsx
  • components/glassyui/lib/preferences.ts
  • components/glassyui/styles/liquid.css

Usage

Usage

import { GlassSurface } from "@/components/glassyui/glass-surface";

export function SurfaceDemo() {
  return (
    <GlassSurface
      preset="prominent"
      refraction="soft"
      refractionBackground={<div className="absolute inset-0 bg-[linear-gradient(135deg,#f5f5f7_58%,#ff754c_63%,#f04a28_70%,#e5e5e7_75%)]" />}
      refractionBackgroundSpace="viewport"
      className="p-6"
    >
      Refractive surface
    </GlassSurface>
  );
}

Examples

Bends light.Scroll to watch.

The wallpaper holds still, and the pane bends a copy of it that stays lined up as the page scrolls.

Glass over a fixed wallpaper

<div className="fixed inset-0 -z-10 bg-[url(/wallpaper.jpg)] bg-cover" />
<GlassSurface
  preset="showcase"
  refraction="strong"
  refractionBackground={<div className="absolute inset-0 bg-[url(/wallpaper.jpg)] bg-cover" />}
  refractionBackgroundSpace="viewport"
  className="p-10"
>
  Bends light
</GlassSurface>
Static surface

<GlassSurface interactive={false} preset="subtle">
  Static glass
</GlassSurface>

API

GlassSurface

Forward-ref surface component rendered as a div.

GlassSurfaceProps

Native div props plus Glassy UI material and refraction options.

SurfacePreset

Exported material preset type.

SurfaceRefraction

Exported none, soft, or strong refraction type.

preset

Material strength: subtle, standard, prominent, control, or showcase.

lens

Chromium lens: the rim is a slab of glass that bends and splits the page behind it. On by default for the control and showcase presets, and for dialogs, popovers, sheets and menus.

thickness

Glass thickness as a multiple of regular (1). Thicker glass widens the rim, bends the backdrop further and splits more colour. Defaults to the thickness preference. Works with a supplied backdrop in every browser, or with the Chromium lens over live content.

refraction

Material level: none, soft, or strong. Generated refraction requires refractionBackground.

refractionBackground

Decorative visual layer bent inside the surface; do not pass semantic or interactive content.

refractionBackgroundSpace

Coordinate space for the supplied layer: local (default) or viewport. Viewport keeps the scene fixed while the surface scrolls.

refractionDisplacement

Bend strength for supplied-background refraction, 72 for soft and 112 for strong by default. The rim bend is capped so it never mirrors the scene.

interactive

Brightens the surface a touch on hover. Defaults to false.

Notes

Accessibility

Keep the Radix-backed semantics intact and preserve visible labels, focus states, and keyboard operation when copying the source.

Performance

Use provider quality preferences for dense app screens. Reserve strong refraction for hero or showcase surfaces.