Browse docsButton

Controls

Glass Button

A slab of glass resting just above the page that sets down when pressed and lights up where you press.

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

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 Button

pnpm dlx shadcn@4.14.1 add @glassyui/glass-button
What this installs9 files, 2 packages

Direct registry declarations

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

Package dependencies

  • @radix-ui/react-slot
  • clsx

Registry dependencies

  • @glassyui/glass-provider

File targets

  • components/glassyui/glass-button.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

  • @radix-ui/react-slot
  • clsx

Installed files

  • components/glassyui/glass-button.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 { GlassButton } from "@/components/glassyui/glass-button";

export function ButtonDemo() {
  return <GlassButton>Save changes</GlassButton>;
}

Examples

Variants

<div className="flex gap-3">
  <GlassButton variant="prominent">Prominent</GlassButton>
  <GlassButton variant="primary">Primary</GlassButton>
  <GlassButton variant="soft">Soft</GlassButton>
  <GlassButton variant="ghost">Ghost</GlassButton>
</div>
As a link

<GlassButton asChild variant="prominent">
  <a href="/pricing">See pricing</a>
</GlassButton>

API

GlassButton

Forward-ref native button with owned glass interaction state.

GlassButtonProps

Native button props plus Glassy UI material options.

ButtonVariant

Exported primary, prominent, soft, or ghost visual-intent type.

ButtonSize

Exported sm, md, or lg size type.

variant

Visual intent: primary (clear glass, the default), prominent (blue glass for the main action: it tints whatever lies behind it and keeps white text at 4.5:1), soft, or ghost.

asChild

Renders the single child element, such as a link, with the button material. Links cannot be disabled.

size

Control size: sm, md, or lg.

preset

Material preset applied to the button surface.

lens

Chromium lens: the rim bends and splits the page behind it. On by default for every variant except ghost.

Notes

Motion

The glass rests just above the page, lit from above. A pointer lowers it and a press sets it down, so its shadow draws in under it, and light spreads from the point you press. Reduced motion moves it at once and drops the light.

Glass Scene

Inside a Glass Scene the canvas draws the button as real glass that bends the backdrop.

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.