UI Overview
@univerjs-pro/boards-ui is the licensed browser canvas for Univer Boards. It renders the scene, handles selection and viewport interactions, and provides the toolbars, context menus, text editing, shape editing, connector editing, and UI for the supported Board element types.
Register the Board UI
Configure UniverLicensePlugin before the Board plugins. Docs, Drawing, Ink, and Shape Editor are technical dependencies for rendering and editing; using Boards does not require prior knowledge of those products.
UniverBoardsUIPlugin
workbenchobjectWorkbench layout options.contentbooleanDefault:trueShows the main content area.headerbooleanDefault:falseShows the header.headerMenubooleanDefault:falseShows the header menu.toolbarbooleanDefault:falseShows the toolbar.
interactionobjectCanvas zoom and panning options.minZoomRationumberDefault:0.02Sets the minimum zoom ratio.maxZoomRationumberDefault:4Sets the maximum zoom ratio.wheelZoomWithModifierbooleanDefault:trueEnables wheel zoom with a modifier key.trackpadPanEnabledbooleanDefault:trueEnables panning with the trackpad.
interactionMode'editing' | 'viewing'Default:'editing'Starts in editing or viewing mode. Document permissions still apply.gridVisiblebooleanDefault:falseShows the canvas grid.gridobjectGrid colors and spacing.gridSizenumberDefault:32Minor grid spacing in canvas units.lineColorstringDefault:'rgba(100, 116, 139, 0.48)'Color of minor grid lines.majorGridSizenumberDefault:160Major grid spacing in canvas units.majorLineColorstringDefault:'rgba(100, 116, 139, 0.72)'Color of major grid lines.
quickAddEnabledbooleanDefault:trueShows the quick-add controls.preciseSelectionbooleanDefault:falseRequires more precise hits to select elements.showDimensionsbooleanDefault:falseShows dimension indicators.showToolbarbooleanDefault:trueShows the canvas toolbar.modeSwitcherVisiblebooleanDefault:trueShows the interaction-mode switcher.collaboratorCursorsVisiblebooleanDefault:trueShows other collaborators’ cursors.viewportBarobjectViewport scrollbar settings.enabledbooleanDefault:trueEnables the viewport scrollbars.horizontalbooleanDefault:trueShows the horizontal scrollbar.verticalbooleanDefault:trueShows the vertical scrollbar.paddingnumber | objectDefault:300Padding around the canvas, in canvas units. Use one number or a value per side.topnumberDefault:300Padding at the top.rightnumberDefault:300Padding on the right.bottomnumberDefault:300Padding at the bottom.leftnumberDefault:300Padding on the left.
insertobjectNew element defaults.chartobjectChart size.widthnumberDefault:480Width.heightnumberDefault:270Height.
imageobjectImage size and placement.fallbackWidthnumberDefault:320Width used when the image dimensions are unknown.fallbackHeightnumberDefault:180Height used when the image dimensions are unknown.fitRationumberDefault:0.56Fraction of the visible area used to fit the image.minEdgenumberDefault:80Minimum fitted edge length.minPositionOffsetnumberDefault:24Minimum offset from the viewport origin.
tableobjectTable dimensions.columnsnumberDefault:4Number of columns.rowsnumberDefault:3Number of rows.cellWidthnumberDefault:120Column width.cellHeightnumberDefault:48Row height.minWidthnumberDefault:240Minimum width calculated from the columns.minHeightnumberDefault:96Minimum height calculated from the rows.widthnumberWidth.heightnumberHeight.
shapeobjectShape picker.commonCountnumberNumber of common shapes to display.presetsreadonly IBoardShapePreset[]Shape definitions in the picker.
stickyobjectSticky-note options.colorsreadonly string[]Available colors.
renderAdaptersreadonly IBoardElementRenderAdapter[]Replaces the default render adapters.additionalRenderAdaptersreadonly IBoardElementRenderAdapter[]Adds render adapters to the configured set.
UniverLicensePlugin
licensestringClient license file contents.
univer.registerPlugin(UniverLicensePlugin, { license: process.env.CLIENT_LICENSE_TEXT,})univer.registerPlugin(UniverBoardsPlugin)univer.registerPlugin(UniverBoardsUIPlugin, { workbench: { content: true, header: false, headerMenu: false, toolbar: false, footer: false, }, interaction: { minZoomRatio: 0.1, maxZoomRatio: 4, wheelZoomWithModifier: true, trackpadPanEnabled: true, },})For the full dependency, style, and locale registration order, see Installation & Basic Usage.
Canvas options
IUniverBoardsUIConfig also controls grid appearance, insert defaults, available shapes and sticky-note colors, toolbar tools, viewport bars, render adapters, and options such as quick add, precise selection, dimensions, and collaborator cursors.
Menu configuration and the canvas toolbar
Configure context menus and canvas tools at startup. To change an existing context menu, use the menu Facade API.
How is this guide?