Skip to content
StackD
Generate, the StackD component

AI · Free

Generate

A picture forming like a generated image, with the Bot as the loader in the pill; a failure dries the haze into ink dots.

Free on Gumroad: the download arrives in your inbox.

Details

Category
AI
Plan
Free
Code
React + Tailwind, TypeScript · 429 lines
Files
Generate.tsx
Needs
The Bot (installed with it)
Agents
MCP server and shadcn registry

About

An empty frame with one pill in it. Press Generate and, while your model works, a soft haze drifts in the frame and the count crawls. When the picture arrives it forms the way a generated image does: a few soft masses under a liquid surface, then the forms find their edges, then the fine grain lands as ink dots and melts into the photo.

The Bot is the loader: it rides in the pill, its eyes scanning the frame, next to a count that climbs unevenly (a quick start, a stall, a burst), the way real work does. It never says 100 until the picture has landed, and then it smiles.

If it fails, the haze stops and dries into ink dots, the Bot looks down, and the pill says so and offers to try again.

React + Tailwind and the Bot, no other libraries.

Install

With the shadcn CLI:

npx shadcn@latest add https://www.stackd.codes/r/generate.json

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 Generate component to this project. Use the StackD MCP server: call get_component with { "name": "generate" }, 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.

Use

  1. Copy Generate.tsx and Bot.tsx into the same folder (for example components/).
  2. Use it:
import { Generate } from './components/Generate'

<Generate
  onGenerate={async () => {
    const res = await fetch('/api/image', { method: 'POST', body: JSON.stringify({ prompt }) })
    if (!res.ok) throw new Error('Failed')
    const { url } = await res.json()
    return { src: url, alt: prompt }
  }}
/>

onGenerate resolves with the picture ({ src, alt }) or throws when it fails. While it waits, the haze and the count keep going; the picture forms once it arrives.

Without onGenerate, pass images and each press shows the next one, as a demo.

The picture is read once to draw its grain. If it comes from another site, that site has to allow it (CORS); if not, it still forms, just without the ink dots.

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

Options

PropDefaultWhat it does
onGenerateMakes the picture: resolve with { src, alt }, or throw
imagesWithout onGenerate: one per press, as a demo
pace5Seconds the picture takes to form once it has arrived
ripple50How liquid the surface is while it forms, 0 to 100
theme'light''light' (paper) or 'dark' (ink)
width / height320 / 400Frame size in px
corner22Corner radius in px
failText"Couldn't generate"What the pill says when it fails
onDoneCalled with the picture when it has landed
onFailCalled with what was thrown
freezeHold one still moment for covers and mock-ups: { image, at: 0.8 } or 'failed'
classNameExtra classes

Accessibility

The pill is a real button that says what's happening ("Generating, 42%", "Couldn't generate. Try again"), and a status line tells screen readers when the picture is ready. The frame is labelled with the picture's alt. With reduced motion on there is no liquid surface or grain: the picture just fades in.

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.