User Roles
Switch between admin and user modes to control editing capabilities
User roles in Polotno Editor change UI behavior for different workflows. Polotno has three built-in roles: admin, user, and viewer.
Note: Roles only affect UI interactions. Programmatic API (element.set(), store.find(), etc.) always works regardless of role.
Roles overview
| Role | Can edit elements | Can select locked elements | Access to locking UI | Typical use case |
|---|---|---|---|---|
| user (default) | Yes | No | Lock toggle only | End users editing within defined constraints |
| admin | Yes | Yes | Lock toggle and fine-grained controls | Template creators, designers setting up restrictions |
| viewer | No | No | No | Read-only previews, published designs, approval views |
The toolbar's Lock toggle is shown in the user role too, and it unlocks any element the user can select. To keep an element fixed for end users, make it selectable: false, or replace the Lock button with your own component.
Setting a role
// Set admin role (typically for template creators)
store.setRole('admin');
// Set user role (default, for end users)
store.setRole('user');
// Set viewer role (read-only, no editing)
store.setRole('viewer');
// Check current role
console.log(store.role); // 'admin', 'user', or 'viewer'Admin mode capabilities
When admin mode is enabled, the UI changes:
- Select locked elements: Can click and select elements marked as
selectable: false - Access locking UI: Extra controls appear in the toolbar to set element restrictions
- Configure export behavior: Toggle
showInExportto hide elements from final output - Fine-grained locking: Control which aspects of an element can be edited (see Element Locking)

Viewer mode capabilities
When viewer mode is enabled, the canvas becomes read-only:
- No selection: Elements can't be selected by clicking
- No editing: Drag, resize, rotate, and inline text editing are all disabled
- No toolbars or context menus: Element-specific UI is hidden
- Programmatic API still works. You can drive the store from your own code
// Switch to read-only view
store.setRole('viewer');
// Programmatic changes still apply
store.activePage.children[0].set({ x: 100 });Use viewer mode for design previews, gallery/published views, approval flows, or any surface where users should see a design but not modify it.
Template creator workflow
- Enable admin mode:
store.setRole('admin')to access all elements via UI - Lock background elements: Mark logos, borders, and guides as
selectable: false - Restrict editing: Use
contentEditable: falseon text elements to prevent content changes - Hide guides from export: Set
showInExport: falseon helper elements - Switch to user role: Test the template with
store.setRole('user')to verify restrictions
Use cases
Non-editable overlays
Use admin mode to create watermarks or logos that regular users can't select:
// As admin, create non-selectable element
store.activePage.addElement({
type: 'image',
src: 'logo.png',
selectable: false, // Regular users can't click it
removable: false,
alwaysOnTop: true,
});
// As admin, you can still select it by clicking
// Regular users (role: 'user') cannotEditable content with locked styling
Create template placeholders where users can change text but not styling:
// Create element with mixed locks
store.activePage.addElement({
type: 'text',
text: 'Edit this text',
contentEditable: true, // Can edit text content
styleEditable: false, // Cannot change font, color, etc.
draggable: false, // Cannot move
resizable: false, // Cannot resize
});
// Admin can access locking UI to adjust these settings
// Regular users see the restrictions enforcedExport-only guides
Create guide layers visible during editing but hidden in exports:
store.activePage.addElement({
type: 'figure',
subType: 'rect',
stroke: 'red',
strokeWidth: 2,
fill: 'transparent',
selectable: false,
showInExport: false, // Hidden in export
});
// Admin can toggle this via UI
// Regular users can't interact with itRole vs. programmatic API
Role affects UI only. The programmatic API always works:
// Programmatic API works the same in any role
element.set({ draggable: false, removable: false });
// No need to change role for programmatic operations
const locked = store.find((el) => el.type !== undefined && el.selectable === false);
locked?.set({ x: 100 }); // find returns the first match; works in any roleCustom locking UI
Admin mode provides built-in UI for controlling locks. If you need more flexibility or want to integrate locking controls into your own interface, you can build custom UI.
See Element Locking for:
- Complete locking API reference
- Live demo of custom locking UI
- Examples of building your own lock controls