Liquid glass
for the web.

Glassform ships Svelte and React components with shared glass styles and photo-backed refraction.

Geometric window lines on a Chicago building
Lens · 4 px Matthew Jackson on Unsplash
Water droplets on a green leaf
Soft Lens · 4 px Mark Olsen on Unsplash

Installation

Run this command from a Svelte project configured for shadcn-svelte.

Terminal
bunx shadcn-svelte@1.8.1 add https://glassform.pages.dev/r/glassform.json

The CLI uses your components alias and installs the source in its glassform folder. The CLI requires Tailwind during installation. Glassform uses plain CSS. To install manually, copy the files from the registry item. Open the registry item.

Compose a panel

Display settings
DisplaySettings.svelte
<script lang="ts">
  import GlassProvider from '$lib/components/glassform/GlassProvider.svelte';
  import GlassPanel from '$lib/components/glassform/GlassPanel.svelte';
  import GlassButton from '$lib/components/glassform/GlassButton.svelte';
  import LensStage from '$lib/components/glassform/LensStage.svelte';
</script>

<GlassProvider appearance="system">
  <LensStage photo={{ src: '/images/backdrop.webp' }}>
    <GlassPanel material="lens">
      <h2>Display settings</h2>
      <GlassButton material="embedded">Apply</GlassButton>
    </GlassPanel>
  </LensStage>
</GlassProvider>

Use your own backdrop image at the path passed to LensStage.

Install for React

Run this command in a React project configured for shadcn. The files go under its components alias.

Terminal
bunx shadcn@latest add https://glassform.pages.dev/r/glassform-react.json

Supply a backdrop image to LensStage to enable the shared WebGL optics.

SettingsPanel.tsx
import {
  GlassProvider, GlassPanel, GlassButton, LensStage
} from "@/components/glassform/glassform";

export function SettingsPanel() {
  return (
    <GlassProvider appearance="system">
      <LensStage photo={{ src: "/images/backdrop.webp" }}>
        <GlassPanel material="lens">
          <h2>Display settings</h2>
          <GlassButton material="embedded">Apply</GlassButton>
        </GlassPanel>
      </LensStage>
    </GlassProvider>
  );
}

Components

GlassProvider

Scopes appearance, blur, and Solid mode. Nested providers inherit settings they omit.

appearance: system | light | dark · blur: number (px) · solid: boolean · as: div | main | section

LensStage

Supplies a photo backdrop and automatically applies optical refraction to Lens surfaces inside it.

photo: { src, srcset?, sizes?, alt? } · blur: number (px) · ripple: number · refract: boolean · trackPointer: boolean

GlassSurface

The base surface with a shared rim and corner radius. Defaults to Lens.

material: lens | solid

GlassPanel

A padded GlassSurface for grouping content and controls. Accepts the same props as GlassSurface.

material: lens | solid · --glass-panel-padding

GlassButton

A native button that defaults to type="button" and the Solid material. Use embedded inside a Panel to share its blur.

material: solid | lens | embedded · native button attributes and events

Everyday UI

Bind a control’s value in Svelte and use native labels, validation, and form submission.

Display preferences

Density
Layout

Focus the list and use ↑ or ↓ to scroll.

  • Provider
  • Surface
  • Panel
  • Avatar
  • Kbd
  • Scroll Area
  • LensStage
ComponentProps and usage
GlassAvatarsrc, alt, fallback initials
GlassKbdKeyboard shortcut content
GlassScrollArealabel, --glass-scroll-max-block-size
GlassInputNative input attributes, bind:value
GlassTextareaNative textarea attributes, bind:value
GlassSelectoptions, bind:value
GlassCheckboxNative checkbox attributes, bind:checked
GlassSwitchNative checkbox attributes, bind:checked
GlassSlidermin, max, step, bind:value
GlassRadioGrouplabel, name, options, bind:value
GlassSegmentedControllabel, name, options, bind:value

Use an id with a matching <label for> on individual controls. Groups render their own legend. Share refraction by placing related controls in one Lens panel.

Theming

Set CSS custom properties on a Provider or an individual component. Use appearance="system" to follow the visitor's color preference. Set solid on a Provider for opaque surfaces throughout its scope.

TokenPurposeDefault
--glass-blurBackdrop blur radius4px
--glass-tintTranslucent color behind the content#ffffff14
--glass-rimSurface border colorTheme-dependent
--glass-radiusSurface corner radius24px
--glass-panel-paddingPanel content inset16–32px
--glass-button-radiusButton corner radius999px
--glass-focusKeyboard focus outline colorTheme-dependent
--glass-motionButton feedback duration130ms

Lens rendering

Place material="lens" surfaces inside a LensStage and supply a backdrop image once. The stage treats the image as the source for refraction and discovers Lens surfaces automatically. Lens surfaces outside a stage use CSS backdrop blur.

  • WebGL bends the backdrop with a displacement map. Set trackPointer to enable pointer-driven highlights, or refract={false} for a frosted finish.
  • Fallbacks use SVG displacement where supported, or CSS backdrop blur when an optical renderer is unavailable.
  • Accessibility and performance Glassform uses opaque surfaces in forced colors and with reduced transparency. Group controls on one filtered surface where possible. Device performance is still being evaluated.
Explore refraction in the playground