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

Svelte

Run in a project configured for shadcn-svelte. Its installer requires Tailwind.

Svelte terminal
bunx shadcn-svelte@1.8.1 add https://glassform.pages.dev/r/glassform.json
Svelte registry item

React

Run in a project configured for shadcn.

React terminal
bunx shadcn@latest add https://glassform.pages.dev/r/glassform-react.json
React registry item

Both commands copy the source into the glassform folder under your components alias. Glassform uses plain CSS. For a manual install, copy the files from the registry item.

Compose a panel

These examples put a panel inside a LensStage. Set photo.src to your backdrop image. Compare both lens modes.

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>
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

Core

ComponentProps and usage
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

Surfaces

ComponentProps and usage
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
GlassAvatar src, alt, fallback initials
GlassKbd Keyboard shortcut content
GlassScrollArea label, --glass-scroll-max-block-size

Controls

ComponentProps and usage
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
GlassInput Native input attributes, bind:value
GlassTextarea Native textarea attributes, bind:value
GlassSelect options, bind:value
GlassCheckbox Native checkbox attributes, bind:checked
GlassSwitch Native checkbox attributes, bind:checked
GlassSlider min, max, step, bind:value
GlassRadioGroup label, name, options, bind:value
GlassSegmentedControl label, name, options, bind:value

Everyday UI

Change the settings to see how Glassform controls work together on a Lens panel.

Workspace settings

Profile
Appearance
12 px
Live preview
Glassform

Liquid glass components for the web.

Layout
Density

Surface components

  • Provider
  • Surface
  • Panel
  • Avatar
  • Kbd
  • Scroll Area
  • LensStage

Focus the collection to scroll with ↑ and ↓.

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

Live backdrop blur

Display settings

Use GlassSurface or GlassPanel with material="lens" to blur the page content behind it.

Image-backed refraction

Display settings

Supply a photo to LensStage to bend the image through the Lens surfaces it discovers inside.

  • 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