Pixel Painter
Draw on a pixel grid and save a PNG. Free, MIT · Interactive blocks › Small editors and calculators
A small pixel editor: draw on an 8–32 cell grid with a pencil, eraser, 4-way fill and colour picker, undo whole strokes, and save a PNG with transparency at a whole-number scale without smoothing. The grid has one Tab stop: the arrow keys move a cursor and Space applies the tool, with the cell and its colour announced.
Installation
npx valyro-cli@latest add pixel-painter
npx shadcn@latest add https://valyro.xyz/r/pixel-painter.json
npm install valyro-ui
import 'valyro-ui/styles.css';
import { PixelPainter } from 'valyro-ui';
Props
| Prop | Type | Default | |
|---|---|---|---|
value | PixelDocument | The picture: grid size, palette and cells (palette indexes, row by row). | |
defaultValue | PixelDocument | Initial picture when uncontrolled. Default: a transparent 16 × 16 grid with ten colours. | |
onValueChange | (value: PixelDocument) => void | Called with the new picture when a stroke, fill, undo or redo completes. | |
tools | PixelTool[] | ALL_TOOLS | Tools on the toolbar, in order. Default: pencil, eraser, fill, picker. |
activeColorIndex | number | Palette index of the drawing colour. | |
defaultActiveColorIndex | number | Initial drawing colour when uncontrolled. Default: the first opaque palette entry. | |
onActiveColorIndexChange | (index: number) => void | Called with the new activeColorIndex when it changes. | |
historyLimit | number | 50 | Most undoable actions. Default 50. |
exportScale | number | 1 | Whole-number size factor of the PNG, 1…64; each cell becomes scale × scale pixels without smoothing. Default 1. |
onExport | (blob: Blob) => void | Receives the PNG. Without it, the save button downloads the file. | |
fileName | string | 'pixel-art.png' | Name of the downloaded file. Default pixel-art.png. |
labels | Partial<PixelPainterLabels> | Overrides for the built-in English text; keys left out keep their defaults. |
Related components
- Gradient Mixer — Drag colour points over a canvas and copy the layered CSS gradient
- Crafting Recipe — Recipe card: batches, ingredients needed and what is missing
- Feature Hotspots — Numbered points on an image that open a note about each detail
- Exploded Layers — Prepared image layers pulled apart with captions
- Prediction Card — The reader guesses first, then sees the answer and the explanation
- Detail Dial — Choose how deep an explanation goes: short, detailed or full
- Version Scrubber — Step through prepared versions of a design with one slider
- Page Minimap — Schematic map of a long page with the visible area
- Peel Sticker — A sticker you peel back by its corner to reveal what is under it
- Scratch Reveal — Scratch off a cover to reveal text or a picture
- Tear-off Ticket — A ticket whose stub tears off along the perforation
- Split-Flap Board — Mechanical departure board: only the changed characters flip
Previous: Gradient Mixer · Next: Crafting Recipe · All Interactive blocks