# Containers & Swimlanes

- Human documentation: [https://docs.univer.ai/guides/boards/features/core/containers](https://docs.univer.ai/guides/boards/features/core/containers)

- Agent Markdown: [https://docs.univer.ai/guides/boards/features/core/containers.md](https://docs.univer.ai/guides/boards/features/core/containers.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [boards/features/core/containers.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/boards/features/core/containers.mdx)

---

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

```ts
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

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

## Configure membership behavior

```ts
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.

```ts
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')
```
