Containers & Swimlanes

Containers let Boards represent framed areas, swimlanes, UML package blocks, and other parent-child structures. Container membership is stored on child elements through parentId and, for swimlanes, laneId.

Create a container

TypeScript
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active Board')const containerId = 'scope'const containerCreated = board.createContainer({  id: containerId,  title: 'Scope',  left: 80,  top: 80,  width: 640,  height: 360,})if (!containerCreated) {  throw new Error('Cannot create container')}

Move elements into a container

TypeScript
board.moveElementsToContainer(['card-1', 'card-2'], containerId)board.fitContainerToContent(containerId)

Configure membership behavior

TypeScript
board.setContainerMembershipLocked(containerId, true)board.setContainerAutoResize(containerId, false)

Swimlanes

Swimlanes are containers with lane configuration. Use the dedicated facade APIs to add, remove, resize, reorder, collapse, and rename lanes.

TypeScript
const swimlaneId = 'delivery'const swimlaneCreated = board.createSwimlane({  id: swimlaneId,  left: 80,  top: 80,  width: 720,  height: 360,  orientation: 'horizontal',  lanes: [    { id: 'todo', title: 'Todo', size: 240 },    { id: 'done', title: 'Done', size: 240 },  ],})if (!swimlaneCreated) {  throw new Error('Cannot create swimlane')}board.renameSwimlaneLane(swimlaneId, 'todo', 'Backlog')

How is this guide?

© 2026 DreamNum Co., Ltd.