# 컨테이너 및 스윔레인

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

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

- Requested language: `ko-KR`

- Content language: `ko-KR`

- Documentation version: `1.0.4`

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

---

컨테이너를 사용하면 보드에서 프레임 영역, 스윔레인, UML 패키지 블록 및 기타 부모-자식 구조를 표현할 수 있습니다. 컨테이너 소속 정보는 자식 요소의 `parentId`에 저장되며, 스윔레인의 경우 `laneId`에도 저장됩니다.

## 컨테이너 만들기

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

## 요소를 컨테이너로 이동하기

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

## 소속 동작 설정하기

```ts
board.setContainerMembershipLocked(containerId, true)
board.setContainerAutoResize(containerId, false)
```

## 스윔레인

스윔레인은 레인 설정이 있는 컨테이너입니다. 전용 퍼사드 API를 사용하여 레인을 추가, 제거, 크기 조절, 순서 변경, 축소 및 이름 변경할 수 있습니다.

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