MS Paint

Retro MS Paint style drawing canvas with tools, colors, and undo.

FileEditToolsHelp
For Help, click Help Topics on the Help Menu.

MS Paint recreates the classic Windows paint app in the browser: a canvas with a toolbox, color palette, brush sizes, and undo. Everything is drawn with the native canvas API, so it runs anywhere React does. Use it for playful portfolio pieces, drawing demos, and easter eggs that invite visitors to actually interact with your site.

Installation

Usage

import { MSpaint } from "@/components/ui/ms-paint";
// Basic usage with default settings
<MSpaint />
 
// Custom size and title
<MSpaint
  width={1000}
  height={600}
  title="My Drawing App"
/>
 
// Custom colors and brush settings
<MSpaint
  colorPalette={["#ff0000", "#00ff00", "#0000ff", "#ffff00", "#ff00ff", "#00ffff"]}
  brushSize={5}
  eraserSize={30}
/>
 
// With save callback
<MSpaint
  onSave={(canvas) => {
    const image = canvas.toDataURL('image/png');
    console.log('Canvas saved:', image);
  }}
/>

Props

PropTypeDefaultDescription
widthnumber800Width of the drawing canvas container in pixels
heightnumber500Height of the drawing canvas area in pixels
canvasWidthnumber2000Width of the actual canvas element (determines draw area)
canvasHeightnumber2000Height of the actual canvas element (determines draw area)
colorPalettestring[]DEFAULT_COLORSArray of hex color codes for the color palette
titlestring'untitled - Paint'Title text displayed in the window header
menuItemsstring[]['File', 'Edit', 'View', 'Image', 'Options', 'Help']Array of menu item names to display in the menu bar
classNamestring''Additional CSS classes to apply to the container
styleReact.CSSProperties{}Additional inline styles to apply to the container
onSave(canvas: HTMLCanvasElement) => voidundefinedCallback function when the save button is clicked
brushSizenumber2Size of the brush used for drawing
eraserSizenumber20Size of the eraser used for erasing