Containers & Swimlanes

Containers represent framed areas, swimlanes, UML package blocks, and other parent-child structures on a Board. Container membership is stored on the child elements: parentId identifies the container, and swimlane members also carry 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')}

Insert a container from the canvas

The Container panel in the canvas toolbar provides four preset tiles with fixed aspect ratios: 16:9, 4:3, 1:1, and A4. It also provides a custom container action next to the section heading, and compact vertical and horizontal swimlane buttons. For programmatic insertion, use createContainer() or createSwimlane().

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

A swimlane is a container with lane configuration. Dedicated facade APIs 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.