Skip to content
Theme

Canvas viewport

A design tool's canvas: content in its own units, which scrolling pans and ⌘ or Ctrl with scrolling (or a pinch) zooms about the pointer. Its zoom bar fits the content, shows it at 100%, and zooms in and out.

Examples

Scroll to pan, ⌘ and scroll to zoom; 0 fits, 1 shows 100%

Props

CanvasViewport

A design tool's canvas: content drawn in its own units, which scrolling pans and ⌘ or Ctrl with scrolling (and a trackpad pinch) zooms about the pointer. Its zoom bar fits the content, shows it at 100%, and zooms in and out; with the canvas focused, + and − zoom, 0 fits and 1 shows 100%.

PropTypeDefaultDescription
labelstring—Names the canvas for screen readers.
contentWidthnumber—The content's size, in its own units, for fitting it.
contentHeightnumber—
childrenReactNode—SVG elements in the content's units.
onKeyDown?((event: KeyboardEvent<HTMLDivElement>) => void)—Keys pressed while the canvas has focus, after its own (zoom) have had their turn.

Artboard

The surface a design sits on.

PropTypeDefaultDescription
xnumber—
ynumber—
widthnumber—
heightnumber—

CanvasInk

Outlined artwork: a path in the text colour, or the muted one.

PropTypeDefaultDescription
dstring—
transform?string—
muted?booleanfalse
layer?string—Names what it draws, for tests and tools that find it on the canvas.

CanvasGuide

A horizontal guide across the artwork: a baseline, an x-height, a cap height.

PropTypeDefaultDescription
x1number—
x2number—
ynumber—

CanvasBox

An outlined box: a glyph's bounds, or the clearspace.

PropTypeDefaultDescription
xnumber—
ynumber—
widthnumber—
heightnumber—
selected?booleanfalseDrawn in the focus colour: the thing an edit applies to, such as a selected letter.

CanvasCaret

A text cursor: where a kerning edit applies.

PropTypeDefaultDescription
xnumber—
y1number—
y2number—

CanvasHitArea

An invisible area that takes clicks, such as the text a kerning cursor is placed in.

PropTypeDefaultDescription
xnumber—
ynumber—
widthnumber—
heightnumber—
onClick(event: MouseEvent<SVGRectElement, MouseEvent>) => void—

Keyboard

KeyDoes
+ or −Zoom in or out about the centre
0Zoom to fit
1Zoom to 100%

Accessibility

  • A focusable group described as a "canvas"; every zoom action is also a named button in its toolbar.