Building a screen
The rules for a whole screen of glass: where it goes, one height per row, icons, gaps, and a list to check before you finish.
Each component page shows one glass on its own. A real screen (an editor, a dashboard, a settings page) holds many at once, and the layout is yours: panels, grid and spacing are your own plain markup. The heights and the 8 px between glass buttons are the kit's and always hold. The gaps are starting points: where your project has a spacing scale, use its tokens.
Glass on the controls, plain panels
Buttons, a toolbar, tabs, a slider and a menu are glass. The panels that hold them (a sidebar, an inspector, a timeline) are plain elements with your own background and border. GlassCard is a small card of content over colour or motion, never a layout box. Keep GlassActionButton to one per screen, for the action the screen exists for.
Give clear glass something to bend
Clear glass shows what is behind it: colour, an image, text, shapes. Over a flat, empty panel it reads as a grey pill; there, use material="tinted" with a bg-* class. The backdrop is painted from your DOM: background colours, linear and radial gradients, images, text and inline SVG. The glass does not see shadows, ::before/::after, conic gradients, masks, rotation or CSS filters.
One height per row
A row of controls is 40 or 48 px tall, and everything in it takes the size that gives that height. Set density with size, never by scaling or by overriding the height.
- A 40 px row:
GlassButton,GlassActionButton,GlassButtonGroupandGlassTabsatmd(their default),GlassSlideToConfirmatsm. - A 48 px row: the same four at
lg,GlassSlideToConfirmatmd, andGlassSelectandGlassSearch, which are 48 px and take nosize. A row that holds a select or a search is a 48 px row. - A compact 32 px row:
GlassButton,GlassActionButtonandGlassButtonGroupatsm.GlassTabsatsmis 36 px. Switch(22, 28, 36 px) andCheckbox(18, 22, 28 px) sit centred in the row.RangeSliderandGlassSlideToConfirmfill the width of their container;GlassSelectis 256 px wide unlessclassNamegives it a width (w-full), andGlassSearchtakes its width fromclassName.
Icons for actions, words for choices
The kit ships no icons: install an icon set before you build a toolbar. The examples use Hugeicons (@hugeicons/react with @hugeicons/core-free-icons), written <HugeiconsIcon icon={PlayIcon} />; any set of inline SVG icons works. Transport and editing actions (play, skip, undo, redo, split, zoom) are icons, each with an aria-label. Choices the user reads (tabs, options, the main call to action) stay words. GlassButton takes its icon as icon; an icon alone is className="w-10 !px-0" at md. The component sizes the icon: never set its size.
import { HugeiconsIcon } from '@hugeicons/react'
import { PlayIcon, Redo02Icon, ScissorsIcon, SkipBackIcon, SkipForwardIcon, Undo02Icon } from '@hugeicons/core-free-icons'
import { GlassButton, GlassButtonGroup, GlassButtonGroupItem, GlassButtonGroupSeparator } from '@/components/liquid-glass'
// Good: one 40 px row. Actions that belong together share a group, icons carry the
// actions, the action that cannot run is disabled, and one tinted button is the main action.
export function Toolbar() {
return (
<header className="flex h-14 items-center gap-2 px-4">
<span className="text-sm font-semibold">Untitled project</span>
<GlassButtonGroup aria-label="Transport" className="mx-auto">
<GlassButtonGroupItem aria-label="Back 2 seconds"><HugeiconsIcon icon={SkipBackIcon} /></GlassButtonGroupItem>
<GlassButtonGroupItem aria-label="Play"><HugeiconsIcon icon={PlayIcon} /></GlassButtonGroupItem>
<GlassButtonGroupItem aria-label="Forward 2 seconds"><HugeiconsIcon icon={SkipForwardIcon} /></GlassButtonGroupItem>
</GlassButtonGroup>
<GlassButtonGroup aria-label="Edit">
<GlassButtonGroupItem aria-label="Undo"><HugeiconsIcon icon={Undo02Icon} /></GlassButtonGroupItem>
<GlassButtonGroupItem aria-label="Redo" disabled><HugeiconsIcon icon={Redo02Icon} /></GlassButtonGroupItem>
<GlassButtonGroupSeparator />
<GlassButtonGroupItem aria-label="Split"><HugeiconsIcon icon={ScissorsIcon} /></GlassButtonGroupItem>
</GlassButtonGroup>
<GlassButton material="tinted" className="bg-blue-600 text-white">Export</GlassButton>
</header>
)
}// Bad: words where icons belong, three heights in one row, buttons 4 px apart (they melt),
// a button faded by hand, a badge holding a sentence and an empty strip in the middle.
<header className="flex items-center gap-1 px-2">
<GlassBadge>draft · saved</GlassBadge>
<div className="flex-1" />
<GlassButton size="sm">Undo</GlassButton>
<GlassButton size="lg">Redo</GlassButton>
<GlassButton className="opacity-40">Split</GlassButton>
</header>Group with space, on one scale
- Without a scale of your own, start here: 8 px between the controls of a row, 12 px between rows, 16 px of padding inside a panel, 12 px between panels. The gap between two groups is at least twice the gap inside one.
- Two glass buttons closer than 6 px begin to melt into one body. Keep separate buttons 8 px or more apart, whatever your scale says; actions that belong together go into one
GlassButtonGroupinstead of standing side by side. - Every label, value and control of a panel sits on the panel's two edges: the label on the leading edge, the value on the trailing one. A control that floats between them looks misplaced.
Fill the screen
The columns stretch to the bottom and each scrolls inside itself; a panel that ends where its content ends leaves a hole under it. A bar across the top is full: the name at one end, the actions at the other and the screen's main control between them.
// Good: the page is as tall as the viewport, the row under the bar takes what is left
// (minmax(0, 1fr), so a long list scrolls instead of pushing the page) and every panel scrolls inside itself.
<div className="grid h-dvh grid-rows-[auto_minmax(0,1fr)]">
<Toolbar />
<main className="grid min-h-0 grid-cols-[280px_minmax(0,1fr)_320px] gap-3 p-3">
<aside className="min-h-0 overflow-auto rounded-2xl border border-white/10 bg-white/5 p-4">{/* media */}</aside>
<section className="grid min-h-0 grid-rows-[minmax(0,1fr)_auto] gap-3">{/* preview, timeline */}</section>
<aside className="min-h-0 overflow-auto rounded-2xl border border-white/10 bg-white/5 p-4">{/* inspector */}</aside>
</main>
</div>One word in a badge
GlassBadge is 22 by 64 px and its text flows through the glass, over and over. It is made for one short word that fits the glass whole ("New", "Beta": about six letters). Anything longer is never seen in one piece: a status with more to say ("Draft · saved") is a plain element of your own.
Pick what opens by what it holds
- A value of a form field, one among several (a blend mode, a role):
GlassSelect. - A few plain actions out of a button, or out of the three dots of a
GlassButtonGroup:GlassDropdownMenu. - Checkbox or radio items, groups, shortcuts, submenus, or a menu that must open on a set side:
GlassMenu. - A little more about one control, with the page still usable around it:
GlassPopover. - A task the whole page waits for:
GlassDialog.
Before you finish
Look for each of these in what you built. Each is a mistake a first draft of a screen makes, with its fix.
- A word on a transport or editing action (
>Undo<,>Play<,>+2s<) → an icon with anaria-label. - Two values of
sizein one row, orh-*andscale-*on a glass control → onesizefor the row: 40 or 48 px. gap-1orgap-0.5betweenGlassButtons →gap-2or more, or oneGlassButtonGroup.GlassBadgewith a space or more than about six letters in it → a plain element.opacity-*on a button that cannot be used →disabled.GlassCardaround a sidebar, an inspector or the whole page → a plain panel.- Clear glass over a panel of one flat colour →
material="tinted"and abg-*class. - A panel shorter than its column, or
1frbeside a long list →min-h-0on the panel,minmax(0, 1fr)on the track, the scrolling inside the panel. - A
flex-1spacer with nothing in it across the top bar → the screen's main control goes there, or the bar closes up. - A
GlassSelectand amdbutton in one row → the row is 48 px: the button takeslg.
Liquid Glass is built and maintained by one person. If it saves you time, you can sponsor the work.