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.
- 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. - 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,
lightinCOHESION). Pull the round button towards the wide one in the "Hold and drag" example to see it. The engine does it for every button (COHESIONinengine.ts); a card, a menu or a lens never melts. - 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.
- v1.6.12ImprovedA new
pullprop 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 arePULLinengine.ts, andon: falsethere turns it off everywhere. The motion is that of Glass HQ's liquid-glass (MIT), ported onto the kit's engine. - v1.5.1ImprovedReturn a Promise from
onClickand the button stays pending until it settles: no second press, and screen readers are told. - v1.3.6ImprovedThe Play example is fully clear (
tint={0}): only the bent grid shows through. - All changes →
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.jsonThe 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
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
materialtintsizeiconpullOne 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
| Prop | Type | Default |
|---|---|---|
materialClear bends the page; tinted uses the background colour. | 'clear' | 'tinted' | 'clear' |
sizeHeight 32, 40, 48 or 64 px. | 'sm' | 'md' | 'lg' | 'xl' | 'md' |
iconAn icon element (e.g. a lucide-react icon). | ReactNode | — |
iconPositionWhich side the icon sits on. | 'start' | 'end' | 'end' |
tintClear glass only: how much tint covers the backdrop (0–1). | number | 0.6 |
asChildPut the glass on the single child element instead of a | boolean | false |
pullHold and drag: the button follows the pointer a little way, stretches along the pull and swings back when let go. | boolean | true |
…restPassed to the button: | button attributes | — |
Accessibility
- A real
<button>(or your own element withasChild): 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.