Skip to main content

Component Reference

<kritzel-editor>

The high-level editor component. Wraps <kritzel-engine> and adds a toolbar, utility panel, context menus, settings dialog, export dialog, and workspace manager.

Props

PropertyAttributeTypeDefaultDescription
scaleMaxscale-maxnumberABSOLUTE_SCALE_MAXMaximum zoom scale allowed
scaleMinscale-minnumberABSOLUTE_SCALE_MINMinimum zoom scale allowed
lockDrawingScalelock-drawing-scalebooleantrueWhen true, objects are drawn at a fixed visual size regardless of zoom
viewportBoundaryLeftviewport-boundary-leftnumber-InfinityLeft boundary in world coordinates
viewportBoundaryRightviewport-boundary-rightnumberInfinityRight boundary in world coordinates
viewportBoundaryTopviewport-boundary-topnumber-InfinityTop boundary in world coordinates
viewportBoundaryBottomviewport-boundary-bottomnumberInfinityBottom boundary in world coordinates
controlsKritzelToolbarControl[]Default toolbarToolbar items (selection, brush, line, eraser, text, shape, image, config)
globalContextMenuItemsContextMenuItem[]Paste, Select AllContext menu when right-clicking the canvas background
objectContextMenuItemsContextMenuItem[]Copy, Paste, Order, Align, Group, DeleteContext menu when right-clicking a selected object
customSvgIconsRecord<string, string>{}Custom SVG icon definitions by name
isControlsVisibleis-controls-visiblebooleantrueShow/hide the toolbar
isUtilityPanelVisibleis-utility-panel-visiblebooleantrueShow/hide the utility panel (undo/redo, zoom)
syncConfigKritzelSyncConfigundefinedSync provider configuration

Events

EventPayload TypeDescription
isReadyHTMLElementEmitted when the editor is fully initialized
objectsChangeKritzelBaseObject[]Emitted when objects are added, removed, or modified
objectsAddedObjectsAddedEventEmitted when objects are added
objectsRemovedObjectsRemovedEventEmitted when objects are removed
objectsUpdatedObjectsUpdatedEventEmitted when objects are updated
undoStateChangeKritzelUndoStateEmitted when undo/redo availability changes
themeChangeThemeNameEmitted when the theme changes
viewportChangeKritzelViewportStateEmitted on pan, zoom, or resize

Methods

The editor exposes the same methods as <kritzel-engine>. See the API Reference.


<kritzel-engine>

The low-level canvas engine. Handles rendering, pointer events, viewport management, undo/redo, and workspace management. Does not include any UI chrome — use this when building a fully custom interface.

Props

PropertyAttributeTypeDefaultDescription
cursorTargetHTMLElementdocument.bodyElement to apply cursor styles to
globalContextMenuItemsContextMenuItem[]undefinedContext menu items for canvas background
objectContextMenuItemsContextMenuItem[]undefinedContext menu items for selected objects
lockDrawingScalelock-drawing-scalebooleantrueFixed visual size for drawn objects regardless of zoom
scaleMaxscale-maxnumberABSOLUTE_SCALE_MAXMaximum zoom scale
scaleMinscale-minnumberABSOLUTE_SCALE_MINMinimum zoom scale
syncConfigKritzelSyncConfigundefinedSync provider configuration
themetheme'light' | 'dark''light'Active theme
viewportBoundaryLeftviewport-boundary-leftnumber-InfinityLeft pan boundary
viewportBoundaryRightviewport-boundary-rightnumberInfinityRight pan boundary
viewportBoundaryTopviewport-boundary-topnumber-InfinityTop pan boundary
viewportBoundaryBottomviewport-boundary-bottomnumberInfinityBottom pan boundary
workspaceKritzelWorkspaceundefinedThe active workspace

Events

EventPayload TypeDescription
isEngineReadyKritzelEngineStateEmitted when the engine is fully initialized
activeToolChangeKritzelBaseToolEmitted when the active tool changes
longpressPointerEventEmitted on long-press (useful for mobile context menus)
objectsChangeKritzelBaseObject[]Emitted when objects are added, removed, or modified
objectsAddedObjectsAddedEventEmitted when objects are added
objectsRemovedObjectsRemovedEventEmitted when objects are removed
objectsUpdatedObjectsUpdatedEventEmitted when objects are updated
objectsInViewportChangeKritzelBaseObject[]Emitted when visible objects change (after pan/zoom)
objectsSelectionChangevoidEmitted when selected objects change
undoStateChangeKritzelUndoStateEmitted when undo/redo availability changes
viewportChangeKritzelViewportStateEmitted on pan, zoom, or resize
workspacesChangeKritzelWorkspace[]Emitted when workspaces are created, updated, or deleted

Methods

See the API Reference.