Surfaces
Glass Surface
Low-level refractive surface primitive for custom glass components.
Preview
Release 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:
pnpm dlx [email protected] add @glassyui/glass-surfaceDirect 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.tsxcomponents/glassyui/lib/merge-refs.tscomponents/glassyui/lib/use-local-light.tscomponents/glassyui/lib/refraction-map.tscomponents/glassyui/lib/use-refraction-filter.tsx
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.tsxcomponents/glassyui/lib/merge-refs.tscomponents/glassyui/lib/use-local-light.tscomponents/glassyui/lib/refraction-map.tscomponents/glassyui/lib/use-refraction-filter.tsxcomponents/glassyui/glass-provider.tsxcomponents/glassyui/liquid-filters.tsxcomponents/glassyui/lib/preferences.tscomponents/glassyui/styles/liquid.css
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,#22d3ee,#a78bfa,#34d399)]" />}
className="p-6"
>
Refractive surface
</GlassSurface>
);
}Examples
<GlassSurface interactive={false} preset="subtle">
Static glass
</GlassSurface>API
GlassSurfaceForward-ref surface component rendered as a div.
GlassSurfacePropsNative div props plus Glassy UI material and refraction options.
SurfacePresetExported material preset type.
SurfaceRefractionExported none, soft, or strong refraction type.
presetMaterial strength: subtle, standard, prominent, control, or showcase.
refractionMaterial level: none, soft, or strong. Generated refraction requires refractionBackground.
refractionBackgroundDecorative visual layer bent inside the surface; do not pass semantic or interactive content.
refractionDisplacementOptional bounded displacement override for supplied-background refraction.
interactiveEnables local pointer lighting when interaction preferences allow it.
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.