Skip to content
StackD
Pixel promo, the StackD component

Text · Free

Pixel promo

A discount badge made of pixels, each one filled with halftone dots: it builds itself row by row, and a halftone lens follows your cursor.

Free on Gumroad: the download arrives in your inbox.

Details

Category
Text
Plan
Free
Code
React + Tailwind, TypeScript · 191 lines
Files
PixelPromo.tsx
Needs
React and Tailwind only
Agents
MCP server and shadcn registry

About

A discount badge built from pixels, each one filled with halftone dots like old print.

The coupon sweeps in from the left, then the figure scans in row by row as its dots grow. The top edge of each stroke is the brightest, the sides a little less and the inside dim, so the figure reads as raised. Point at it and a halftone lens follows you: the dots swell, and the black around them shows its grain. Click and it builds again.

One canvas, drawn only while something moves and only while it's on screen. React + Tailwind, no other libraries.

Install

With the shadcn CLI:

npx shadcn@latest add https://www.stackd.codes/r/pixel-promo.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 Pixel promo component to this project. Use the StackD MCP server: call get_component with { "name": "pixel-promo" }, 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 PixelPromo.tsx into your project (for example components/).
  2. Use it:
import { PixelPromo } from './components/PixelPromo'

<PixelPromo text="-30%" />

// White on a dark page, with smaller pixels
<PixelPromo text="€9.99" theme="dark" cell={12} />

It draws at its own size (width = pixels across × cell) and shrinks to fit a narrower container.

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

Options

PropDefaultWhat it does
text'-30%'What the badge says. Digits and - + % $ € . (other characters are left blank)
cell16One pixel, in px
dots5Halftone dots across one pixel
theme'light''light' (black badge) or 'dark' (white badge, for dark pages)
classNameExtra classes

Accessibility

The canvas is an image named with its text (for example "-30%"). With reduced motion on, it shows the finished badge, with no build and no lens.

Colours from StackD

Ink #141310 · Paper #F2F0EC

Licence

You can use it in personal and commercial projects. Don't resell or share the component on its own.