Drawesome

Drawesome is a drawing toolbar for React. Seven pens, an eraser, SVG and PNG export, and nothing to install beyond React. Two lines to drop into an app.

Placeholder copy goes here. Use this paragraph to explain why the project exists, what problem kept coming up, and the moment you decided to stop rebuilding it from scratch and turn it into something reusable instead.

A second paragraph can describe the part you spent the most time on.1 Talk about the interaction you obsessed over, the trade-off you made, and how each state of the interface flows into the next one without a hard cut.


Getting started

npm install drawesome

It fills its parent container. Give the wrapper a height.

import { Draw } from 'drawesome'import 'drawesome/styles.css'<div style={{ height: 400 }}>  <Draw /></div>

The tools

Pencil
Pen
Fineliner
Marker
Highlighter
Brush
Fountain Pen
Eraser

Describe how the tools behave here. A sentence or two about what makes each one feel like the real thing, and the small detail that took the longest to get right. This is a good spot for the line people quote back to you.

Follow it with a shorter paragraph that adds one more detail, so the section ends on something concrete.


Making it yours

Explain your defaults and why you chose them. The goal is that the first thing anyone tries already looks right, and everything below is optional.2

Pick the tools and the order they sit in, and switch off anything you don't need:

<Draw  tools={['pencil', 'marker', 'highlighter']}  controls={{ undo: false, clear: false }}/>

theme takes light, dark or auto, which follows the system setting. The bar above is on auto.

placement puts the bar on an edge, and inset and align fine-tune where it sits. motion sets how it arrives and leaves. draggable lets people move it. swatches swaps in your own palette.

Two props change how the bar is drawn: look="studio" lights the tools like objects, and depth sets how much shadow it casts. The demo above uses studio.

The canvas is yours. Give background a colour, or set it to transparent to let whatever is behind it show through, which is how the demo sits on graph paper.

<div className="your-paper">  <Draw background="transparent" /></div>

On narrow screens the default toolset runs off both edges, so under 680px the demo moves the bar to the left edge and trims the tools:

<Draw  placement={narrow ? 'left' : 'bottom'}  tools={narrow ? ['pencil', 'pen', 'marker', 'highlighter', 'brush'] : undefined}  controls={narrow ? { undo: false, clear: false, opacity: false, custom: false } : undefined}/>

controls switches size and opacity off separately. Turn both off and the button that opens them goes too.

chrome={false} removes the toolbar and leaves only the surface. DrawSurface, Toolbar and the useDrawing hook are exported separately if you'd rather assemble it yourself.

To get the drawing out, put a ref on it. toSvg() returns a string, toPng() returns a blob, and download() saves either one.

await draw.current.download('sketch', 'png', 2)

Props

Surface

board{ w, h }element size
A fixed drawing area, in board units. Left off, the drawing matches the element.
backgroundstring"#ffffff"
Any CSS colour, or "transparent" to paint nothing.
initialStrokesStroke[][]
What to open with, for restoring a saved drawing.
onChange(strokes) => void
Fires on every finished stroke and every erase.
classNamestring
Passed to the root element, along with style.
styleCSSProperties

Tools

toolsPenId[]all seven
Which pens appear, and in what order.
eraserbooleantrue
ink"auto" | "shared" | "per-tool""auto"
Whether picking a colour changes every tool or only the one in hand.
swatchesstring[]18 built-in
Your own palette.
look"classic" | "studio""classic"
How the tools are drawn.
gaugebooleanfalse
Print the current size on the barrel.

Chrome

chromebooleantrue
false leaves the surface and no toolbar.
placement"bottom" | "left" | "right""bottom"
insetnumber | string20
How far the bar sits off its edge.
align"start" | "center" | "end""center"
Where along that edge it sits.
draggablebooleanfalse
Let people pick the bar up and move it.
settings"bar" | "tool""bar"
Where size and opacity live.
controls{ color, size, opacity, undo, clear, custom, minimize }all true
Turn individual controls off.
depth"flat" | "soft" | "regular" | "strong""regular"
How physical the bar looks.
motion"rise" | "none" | { in, out, duration }"rise"
How the bar arrives and leaves.
theme"light" | "dark" | "auto""light"
"auto" follows the system setting.
tooltipsboolean | TooltipOptionstrue
shortcutsbooleantrue
Single-key shortcuts.
startMinimizedbooleanfalse
Start collapsed.
drawWhenMinimizedbooleanfalse
Keep the canvas live while the bar is a disc.

Ref handle

toSvg() => string
Exactly what is on screen.
toPng(scale?) => Promise<Blob>
scale multiplies the resolution.
download(name?, format?, scale?) => Promise<void>
getStrokes() => Stroke[]
setStrokes(strokes) => void
Replaces the drawing.
undo() => void
redo() => void
clear() => void
getSize() => Board
The surface size the drawing is made at.

Every pen has a keyboard shortcut, shown in its tooltip. E for the eraser, [ and ] for size, ⌘Z and ⇧⌘Z for undo and redo. Hold Shift to lock the stroke to eight directions.


Potentially awesome

Close with a short reflection. What the name promises, what it does today, and why you'll keep reaching for it the next time a project needs it.

End on a line with a bit of a wink.

your note goes here

Footnotes

  1. Credit an influence here, and the idea you borrowed from it. ↩

  2. Point readers somewhere else if they need more, like tldraw or Excalidraw. ↩