Canvas
An infinite surface to pan and zoom, with a dotted grid, zoom controls, floating panels and collaborators' cursors.
Rendering Canvas…
Installation
Part of Mlola Pro. Its source is not in the free registry, so the free CLI will not install it; license holders receive it with its stylesheet, under @/components/ui, and it is theirs to edit. See Mlola Pro.
With a license, log the CLI in once with a token from your account, then add it:
npx mlola-ui add canvasUsage
import { Canvas } from "@/components/ui/canvas";
export function Example() {
return <Canvas />;
}Styling comes from the engine stylesheet and the nearest theme. Set it once at the root:
<html data-theme="graphite" data-mode="light">Options
| Component | Prop | Values | Default | Description |
|---|---|---|---|---|
Canvas | grid | dotslinesnone | dots | — |
Canvas | touch | canvaspage | canvas | Who a finger on a touch screen belongs to. canvas (the default): every touch works the canvas, right for a canvas that fills the screen. page: one finger scrolls the page past the canvas and two pan and zoom it, as a map in a page does, for a canvas in the middle of a long page. |
CanvasPanel | position | top-lefttoptop-rightleftrightbottom-leftbottombottom-right | top-left | — |
CanvasCursor | tone | primaryinfosuccesswarningdanger | primary | — |
Every prop with a fixed set of values, read from the exported TypeScript types with its doc comment. Open the Code tab above for the rest of the API.
Accessibility and theming
- Semantic elements, accessible names and state relationships are part of the contract.
- Keyboard, pointer and touch paths are operable; focus stays visible in every theme.
- Light and dark modes pass WCAG AA contrast in all 5 canonical themes.
- Reduced motion and forced colors keep meaning and operation.
Dependencies
Installed alongside this component. No third-party UI runtime is ever added.
@mlola-ui/icons