# Box

**Kind**: interface | **Module**: [Workspaces](https://docs.interop.io/desktop/reference/javascript/workspaces/index.md)

**Source**: https://docs.interop.io/desktop/reference/javascript/workspaces/box/index.html

An object describing a workspace box

## Properties

- **`allowDrop`** (`boolean`, optional)
  Indicates if dropping windows inside this box is allowed
- **`children`** (`WorkspaceElement[]`, required)
  A collection containing the immediate children of this box
- **`frame`** (`Frame`, required)
  An object representing the frame containing this box
- **`frameId`** (`string`, required)
  The unique string identifier of the frame containing this box
- **`height`** (`number`, optional)
  Returns the current height of the box, can be undefined if the API is used with old versions of Enterprise or Core
- **`id`** (`string`, required)
  An unique string identifier of this box
- **`isMaximized`** (`boolean`, optional)
  Returns whether or not the box is maximized
- **`maxHeight`** (`number`, optional)
  Returns the maximum height of the box, calculated by the size constraints of the elements inside it
- **`maxWidth`** (`number`, optional)
  Returns the maximum width of the box, calculated by the size constraints of the elements inside it
- **`minHeight`** (`number`, optional)
  Returns the minimum height of the box, calculated by the size constraints of the elements inside it
- **`minWidth`** (`number`, optional)
  Returns the minimum width of the box, calculated by the size constraints of the elements inside it
- **`parent`** (`Workspace | WorkspaceBox`, required)
  An object representing this box's parent
- **`positionIndex`** (`number`, required)
  An number representing the positing of this box relative to it's siblings
- **`width`** (`number`, optional)
  Returns the current width of the box, can be undefined if the API is used with old versions of Enterprise or Core
- **`workspace`** (`Workspace`, required)
  An object representing the workspace containing this box
- **`workspaceId`** (`string`, required)
  The unique string identifier of the workspace containing this box

## Methods

### addColumn

Adds a new column box to this box.

```ts
(definition?: BoxDefinition | BoxBuilder) => Promise<Column>
```

**Parameters**

- **`definition`** (`BoxDefinition | BoxBuilder`, optional)
  An object describing the type of the requested builder, alongside other settings.

**Returns**: `Promise<Column>`

### addGroup

Adds a new group box to this box.

```ts
(definition?: BoxDefinition | BoxBuilder) => Promise<Group>
```

**Parameters**

- **`definition`** (`BoxDefinition | BoxBuilder`, optional)
  An object describing the type of the requested builder, alongside other settings.

**Returns**: `Promise<Group>`

### addRow

Adds a new row box to this box.

```ts
(definition?: BoxDefinition | BoxBuilder) => Promise<Row>
```

**Parameters**

- **`definition`** (`BoxDefinition | BoxBuilder`, optional)
  An object describing the type of the requested builder, alongside other settings.

**Returns**: `Promise<Row>`

### addWindow

Opens a new window inside this box and loads it's content.

```ts
(definition: WorkspaceWindowDefinition) => Promise<WorkspaceWindow>
```

**Parameters**

- **`definition`** (`WorkspaceWindowDefinition`, required)
  An object describing the requested window.

**Returns**: `Promise<WorkspaceWindow>`

### close

Closes this box all of it's children.

```ts
() => Promise<void>
```

**Returns**: `Promise<void>`

### maximize

Maximizes this box relative to it's parent box.

```ts
() => Promise<void>
```

**Returns**: `Promise<void>`

### removeChild

Removes the first immediate child of this box which satisfies the predicate.

```ts
(predicate: (child: WorkspaceElement) => boolean) => Promise<void>
```

**Parameters**

- **`predicate`** (`(child: WorkspaceElement) => boolean`, required)
  A filtering function (predicate) called for immediate child of this box.

**Returns**: `Promise<void>`

### restore

Restores this box, if previously maximized.

```ts
() => Promise<void>
```

**Returns**: `Promise<void>`

## Related types

- [BoxBuilder](https://docs.interop.io/desktop/reference/javascript/workspaces/boxbuilder/index.md)
- [BoxDefinition](https://docs.interop.io/desktop/reference/javascript/workspaces/boxdefinition/index.md)
- [Column](https://docs.interop.io/desktop/reference/javascript/workspaces/column/index.md)
- [Frame](https://docs.interop.io/desktop/reference/javascript/workspaces/frame/index.md)
- [Group](https://docs.interop.io/desktop/reference/javascript/workspaces/group/index.md)
- [Row](https://docs.interop.io/desktop/reference/javascript/workspaces/row/index.md)
- [Workspace](https://docs.interop.io/desktop/reference/javascript/workspaces/workspace/index.md)
- [WorkspaceBox](https://docs.interop.io/desktop/reference/javascript/workspaces/workspacebox/index.md)
- [WorkspaceElement](https://docs.interop.io/desktop/reference/javascript/workspaces/workspaceelement/index.md)
- [WorkspaceWindow](https://docs.interop.io/desktop/reference/javascript/workspaces/workspacewindow/index.md)
- [WorkspaceWindowDefinition](https://docs.interop.io/desktop/reference/javascript/workspaces/workspacewindowdefinition/index.md)
