Skip to content
StackD
Glass tiles, the StackD component

Images · €7

Glass tiles

Drag over a picture to cover it with glass tiles, and save it as a PNG.

Pay once on Gumroad: the download, plus a licence key for the registry and the MCP server.

Details

Category
Images
Plan
Paid, €7 once
Code
React + Tailwind, TypeScript · 435 lines
Files
GlassTiles.tsx
Needs
The Bot (installed with it)
Agents
MCP server and shadcn registry

About

Drag over a picture to cover parts of it with tiles of glass. Each tile is its own little pane: some frosted, some a lens magnifying a nearby spot, some mirrored, some smeared, each with a white sheen and a thin bright edge, so a covered area reads as glass, not as a grey box. Tiles pop in on a spring as you drag; start a drag on glass and it clears instead. A fast drag leaves no gaps.

An optional toolbar adds a small Bot (StackD Kit 01) that watches the brush and is pleased when you finish a stroke, a tile count, Peek (hold to see the picture underneath), Clear and Save (the picture with its glass as a full-size PNG).

Mouse, touch and keyboard (arrows move, Enter or Space toggles a tile). White and black toolbars. React + Tailwind, no other libraries. Respects reduced motion.

Install

Once: add the StackD registry to components.json, with the licence key from your receipt in STACKD_LICENSE_KEY (in .env.local):

"registries": {
  "@stackd": {
    "url": "https://www.stackd.codes/r/{name}.json",
    "headers": { "X-License-Key": "${STACKD_LICENSE_KEY}" }
  }
}

With the shadcn CLI:

npx shadcn@latest add @stackd/glass-tiles

Or let your agent add it through the StackD MCP server:

claude mcp add --transport http stackd https://www.stackd.codes/mcp

Prompt for your agent

Paste it into Claude Code, Cursor, Codex or VS Code once the MCP server is connected.

Add the StackD Glass tiles component to this project. Use the StackD MCP server: call get_component with { "name": "glass-tiles" }, write the files at the paths it gives and install any npm packages it lists. Then use it where it fits, following its README for the props, and keep its own styles. It is a paid component: if the server says it needs a licence, tell me where to buy it.

Use

  1. Copy GlassTiles.tsx and Bot.tsx into the same folder of your project (for example components/).

If you already have the Bot from an earlier StackD component, replace it with this one.

  1. Give it a picture:
import { GlassTiles } from './components/GlassTiles'

<GlassTiles src="/photos/team.jpg" alt="The team at the offsite" />

Just the picture, square, with bigger tiles and thicker glass, keeping the covered tiles in your state:

const [tiles, setTiles] = useState<number[]>([])

<GlassTiles src="/photos/team.jpg" aspect={1} columns={6} strength={1} toolbar={false} value={tiles} onChange={setTiles} />

Tiles are numbered row by row: row * columns + column, starting at 0 in the top left. Save them and pass them back as defaultValue (or value) to show the same glass later.

In Next.js the files already start with 'use client'. In other React setups that line does nothing.

Options

PropDefaultWhat it does
srcThe picture
alt''Describes the picture for screen readers
aspectthe picture's shapeThe frame's width / height (1 = square). The picture fills it, cropped from the centre
columns8Tiles across. The rows follow the frame's shape
value / defaultValueCovered tiles, controlled or not
onChange(tiles: number[]) => void
strength0.6How thick the glass is, 0 (clear) to 1 (heavy frost)
seed1A number that reshuffles which tile gets which kind of glass
toolbartrueThe bar under the picture: Bot, count, Peek, Clear, Save
download'glass.png'The file name for Save, or false to hide the button
crossOriginSet 'anonymous' for pictures on another domain that allow CORS
theme'light''light' (white bar) or 'dark' (black bar)
botpill, tall eyes{ shape, eyes } for the Bot, from Kit 01
classNameExtra classes on the outer card

Saving

Save draws the picture and its glass onto a canvas at the picture's own resolution, cropped like the frame. Browsers only allow that for pictures from your own site, or from servers that send CORS headers (then add crossOrigin="anonymous"). Otherwise Save says it can't save that picture.

Every tile always gets the same kind of glass (from seed), so a page looks the same on the server and in the browser, and a saved set of tiles looks the same next time.

A note on privacy

The glass is a design effect. Soft glass can still let someone make out a face or a number. To hide something for real, use strength={1} and small tiles, and check the saved PNG.

Colours from StackD

White #FFFFFF · Ink #141310 · Wine #901919 · Olive #6C8544 · Ochre #BE9344 · Lilac #C9B8FF

Licence

You can use it in personal and commercial projects. Don't resell or share the component on its own. The pictures in the previews are from Unsplash and are not included.

Made by StackD · stackd.codes

More in Images