Skip to content

Canvas

Static drawing of shapes and text (charts, diagrams); Motion animates.

Group: Media · Kind: native · in the lite catalog

Bar chart
Line plot
PointerLast press: none

Open in the playground

The same specimen painted by React, SwiftUI, Compose and gpui.

exponential-ui-canvas on Web
exponential-ui-canvas on iOS
exponential-ui-canvas on Android
exponential-ui-canvas on Desktop
fit · contain
fit · cover
fit · fill
pointer
Prop Type Required Bindable Description
size [number] yes – Drawing units [w, h], origin top-left.
shapes [object] yes yes Motion’s shapes (no keys) + upright text on top {text, position, size, weight, align start|center|end, baseline top|middle|alphabetic, font sans|mono, color}.
fit contain | cover | fill – – How it fills the box. Default "contain".
label string – – What it shows, for screen readers.
pointer boolean – – press/move/leave get {x, y} in drawing units. Default false.
style style – – Extra Box styles for the box.
  • on.press: runs an action
  • on.move: runs an action
  • on.leave: runs an action

None.

none

No basic catalog component maps here.

A native component: every renderer paints it directly.

Role: img

img named by label; decorative (hidden) without one. pointer adds no focus stop or role: press/move/leave carry drawing coordinates for pointer users, so put what it shows in the label (or a Table beside it)

Keys Action
None press/move/leave are pointer-only (keyboard users read the label)

Recipe parts: Canvas/root

Keyed by: fit :hover :pressed :focus :disabled :checked :open :selected :invalid :dragover :warning :info

Themes · Write a theme

Motion · Image · ZoomableImage · Icon · Video · AudioPlayer · Avatar · QrCode