Skip to content

Components

ButtonUpdated

A button made of glass. Clear glass bends the page behind it; tinted glass takes your background colour.

Latest changeImprovedv2.0.1The Examples section is back on this page with one example, "Every prop, side by side": one row per prop (material, tint, size, icon, pull), with clear and tinted buttons of different colours next to each other, close enough to melt into one another when you pull one.
  1. v2.0.1ImprovedThe Examples section is back on this page with one example, "Every prop, side by side": one row per prop (material, tint, size, icon, pull), with clear and tinted buttons of different colours next to each other, close enough to melt into one another when you pull one.
  2. v2.0.0ImprovedCohesion: two buttons that come near each other melt into one body, as two drops of liquid do (the fusion of Liquid Glass Studio, MIT). Within reach the sides that face each other lean out, nearer still a bridge forms between them, and it thins and lets go as they part, whatever brings them together: a pull, a swell, the layout. Each glass keeps its own canvas and draws its side of the bridge; across it the two share their bevel, bend, tint and shadow, so the line where they meet does not show. Joined, hold one and part of the light of the press runs on into the other (a little of it by default, light in COHESION). Pull the round button towards the wide one in the "Hold and drag" example to see it. The engine does it for every button (COHESION in engine.ts); a card, a menu or a lens never melts.
  3. v2.0.0FixedThe rim of clear glass mirrors a picture of what lies around it, taken now and then. Taken while a neighbour was still lit by a press (or swollen), it could keep that light on the rim after it had gone, until the pointer came back over the glass. While anything on the page moves or is lit, the glass now keeps the picture it has, and takes a new one at once when all is still.
  4. v1.6.12ImprovedA new pull prop on Button and GlassLayer. A pointer that holds the glass and drags away pulls it after itself: it follows a little way through a rubber band, stretches along the pull and thins across it, and swings back like gel when let go. Small glass (up to 72 px) follows from the point it was pressed at, larger glass once the pointer is past its edge. It is for buttons, and on by default on all of them: Button, Action Button and Button Group (pull={false} on Button or GlassLayer keeps one in its place). No other glass is pulled. The engine does it; its numbers are PULL in engine.ts, and on: false there turns it off everywhere. The motion is that of Glass HQ's liquid-glass (MIT), ported onto the kit's engine.
  5. v1.5.1ImprovedReturn a Promise from onClick and the button stays pending until it settles: no second press, and screen readers are told.
  6. v1.3.6ImprovedThe Play example is fully clear (tint={0}): only the bent grid shows through.
  7. All changes →
glass-button-clear.tsx

Use it for

  • One action: a call to action, a toolbar button, a link that looks like a button.
  • Clear glass over imagery or colour, where the bend shows.

Not for

  • An async action whose result should show on the button: use GlassActionButton.
  • Choosing between options: use GlassTabs.
  • Every button of a dense form: keep the glass for the action that matters.

Installation

npx shadcn@latest add https://liquidglass.onemorethink.dev/r/button.json

The button underneath is UI SDK's, so Button needs @ui-sdk/core and @ui-sdk/react. Return a Promise from onClick and the button stays pending until it settles: it ignores further presses and says so to screen readers. The install command adds both packages at the exact version this was built on: UI SDK is in beta and its API may still change.

Usage

app.tsx
import { GlassButton } from '@/components/liquid-glass'

<GlassButton>Get started</GlassButton>
<GlassButton material="tinted" className="bg-sky-500 text-white">Save</GlassButton>
<GlassButton asChild>
  <Link href="/docs">Read the docs</Link>
</GlassButton>

Examples

Every prop, side by side
glass-button-props.tsx
material
tint
size
icon
pull

One row per prop, its values next to each other: material (clear glass and three colours of tinted glass), tint at 0 and 1 over flat colour, the four of size, icon with iconPosition, and pull. The buttons of a row sit 10 px apart: hold one and pull it towards its neighbour, and the two melt into one body.

API reference

PropTypeDefault
material

Clear bends the page; tinted uses the background colour.

'clear' | 'tinted''clear'
size

Height 32, 40, 48 or 64 px.

'sm' | 'md' | 'lg' | 'xl''md'
icon

An icon element (e.g. a lucide-react icon).

ReactNode—
iconPosition

Which side the icon sits on.

'start' | 'end''end'
tint

Clear glass only: how much tint covers the backdrop (0–1).

number0.6
asChild

Put the glass on the single child element instead of a <button>.

booleanfalse
pull

Hold and drag: the button follows the pointer a little way, stretches along the pull and swings back when let go.

booleantrue
…rest

Passed to the button: onClick, disabled, type, and UI SDK's pendingAnnouncement and focusableWhenDisabled.

button attributes—

Accessibility

  • A real <button> (or your own element with asChild): focus, Enter and Space work as usual.
  • The glass canvas is aria-hidden; only your label is announced.
  • Icon-only buttons need an aria-label.