Glass Tile
A selectable glass grid cell — cheap CSS backdrop-blur by default so it scales to hundreds of items, with an optional real-refraction mode for small grids.
Playground
Edit the props live and copy the config.
<GlassTile selected={selected === i} refract={false} onClick={...}>
{thumbnail}
</GlassTile>Install
npx shadcn@latest add https://websiteglass.com/r/glass-tile.jsonUsage
import { GlassTile } from '@/components/ui/glass-tile';
<div className="grid grid-cols-4 gap-2.5">
{items.map((item, i) => (
<GlassTile
key={item.id}
selected={selected === i}
onClick={() => setSelected(i)}
aria-label={item.name}
>
{item.thumbnail}
</GlassTile>
))}
</div>Props
| Prop | Type | Default | Description |
|---|---|---|---|
selected | boolean | false | Selected state — adds an accent ring and tint. |
refract | boolean | false | Opt into real lens refraction. Off by default (cheap CSS blur). |
children | ReactNode | — | Tile content — thumbnail, icon, emoji, label. |
All native <button> props are forwarded.
Performance
GlassTile is built for grids of hundreds of cells. By default each tile is a
plain CSS backdrop-blur surface with no per-cell SVG filter and no
ResizeObserver, so a large picker stays smooth. The full Glass lens engine is
deliberately not used per cell — it sets up a displacement filter and observer
per instance, which doesn't scale.
For small grids where you want the real bending effect, set refract. That
upgrades the tile to a GlassLens (with a per-tile observer to size it), so use
it only where the cell count is low.
Glass Dock
A liquid-glass bottom-nav dock — a refracting glass bar with a selection pill you can tap or drag between items; the pill lifts into a glass lens with velocity gel as it travels, then settles at the nearest item.
Glass Swatch
A glass-edged colour swatch with a selected accent ring and press — for palette and colour pickers. Use standalone or as a radio group.