Skip to main content

Workspace UI

Workspace is issential part of Polotno framework. It is the main React component that you are going to use to display the drawings and interact with them. You can change canvas and its content programmatically using Store API.

import { Workspace } from 'polotno/canvas/workspace';
import { createStore } from 'polotno/model/store';

const store = createStore({
key: YOUR_API_KEY, // you can create it here:
// you can hide back-link on a paid licence
// but it will be good if you can keep it for Polotno project support
showCredit: true,

const App = () => {
return (
<div style={{ height: '100vh' }}>
<Workspace store={store} />

The Workspace will automatically take full width and height of its parent. So you don't have adjust its size manually. You can just setup the size of parent <div> with CSS.

Customize page controls

You can customize page controls of your <Workspace /> component. You can remove some buttons, add new one, etc. You are in total control on what else you want to see around page on the canvas.

PageControls: ({ width, height, xPadding, yPadding }) => (
position: 'absolute',
top: yPadding + 'px',
left: xPadding + 'px',
My controls here...

Hide page controls

Optionally you can hide UI to add/remove/duplicate pages.

<Workspace store={store} components={{ PageControls: () => null }} />

Workspace styling

Optionally you can change some styles of the workspace.

pageBorderColor="black" // border around page
activePageBorderColor="red" // border around active page. It will be used only if you have several pages. Otherwise just pageBorderColor will be used

No pages UI

If your store has no pages, <Workspace /> component will show a simple UI with a button to create a new page. You can overwrite this UI with your own.

NoPages: ({ store }) => <div>The project has no pages...</div>,