# AdapTable Containers

Canonical page: https://www.adaptabletools.com/docs/dev-guide-tutorial-providing-containers

- Developers can configure custom Div elements that will be used by AdapTable
- These are configured using the ContainerOptions section of AdapTable Options

The Container Options section of [Adaptable Options](https://www.adaptabletools.com/docs/technical-reference-adaptable-options/index.md) contains a series of properties allowing developers to specify various Div elements that can be used in AdapTable.

These include Divs for [Alerts](https://www.adaptabletools.com/docs/handbook-alerting/index.md), [System Status Messages](https://www.adaptabletools.com/docs/ui-tutorial-using-toast-notifications/index.md), the Settings Panel and Wizards, and Transposed Views.

- 2 containers are also available allowing developers to provide custom div names for AdapTable and AG Grid
- These are only required if using AdapTable vanilla - see [Setting AdapTable & AG Grid Containers](https://www.adaptabletools.com/docs/getting-started-setting-adaptable-aggrid-containers/index.md) for more details

All Container Options properties allow the container to be provided in one of 4 ways:

- `string` — an element ID
- `AdaptableCSSSelector` — a CSS selector
- `HTMLElement` — a direct reference to a DOM element
- a JavaScript function which returns any one of the above

### Providing the Container Value

The resolved value is an [`AdaptableContainerValue`](https://www.adaptabletools.com/docs/reference/adaptablecontainervalue.md) — one of 3 shapes:

- `string`: an element ID — resolved via `document.getElementById`
- `AdaptableCSSSelector`: a CSS selector — resolved via `document.querySelectorAll` (if several elements match, the first is used)
- `HTMLElement`: a direct reference to a DOM element

Alternatively, provide a function that returns one of those three. Alert, System Status, Modal and Transposed View functions receive [`ContainerContext`](https://www.adaptabletools.com/docs/reference/containercontext.md) (which includes `adaptableApi`). The AdapTable and AG Grid container functions receive [`InitContainerContext`](https://www.adaptabletools.com/docs/reference/initcontainercontext.md) instead — they run before AdapTable is ready, so there is no API yet.

`ContainerContext` extends [`BaseContext`](https://www.adaptabletools.com/docs/reference/basecontext.md):

| Property | Type | Description |
| --- | --- | --- |
| [adaptableApi](https://www.adaptabletools.com/docs/reference/basecontext.md#adaptableapi) | [`AdaptableApi`](https://www.adaptabletools.com/docs/reference/adaptableapi.md) | Adaptable Api object |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/basecontext.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |
| [adaptableId](https://www.adaptabletools.com/docs/reference/basecontext.md#adaptableid) | `string` | Id of current AdapTable instance |
| [adaptableStateKey](https://www.adaptabletools.com/docs/reference/basecontext.md#adaptablestatekey) | `string` | Current Adaptable State Key |
| [clientTimestamp](https://www.adaptabletools.com/docs/reference/basecontext.md#clienttimestamp) | `Date` | Time on user&#39;s computer |
| [userName](https://www.adaptabletools.com/docs/reference/basecontext.md#username) | `string` | Name of Current User |

## CSS Selector

The [`AdaptableCSSSelector`](https://www.adaptabletools.com/docs/reference/adaptablecssselector.md) object is used to locate a DOM element.

It contains a single `selector` property which is designed to target elements by CSS selectors (e.g. class, attribute, etc.) rather than element ID:

| Property | Type | Description |
| --- | --- | --- |
| [selector](https://www.adaptabletools.com/docs/reference/adaptablecssselector.md#selector) | `string` | CSS Selector that locates DOM element |

The property can be used in multiple different ways, e.g.

```ts
selector: '#my-container'
selector: '.dashboard-panel'
selector: '[data-container="alerts"]'
```

## Alert Container

[Alerts](https://www.adaptabletools.com/docs/handbook-alerting/index.md) in AdapTable can be given a number of [Alert behaviours](https://www.adaptabletools.com/docs/handbook-alerting-behaviours/index.md).

One behaviour (`ShowInDiv`) is to display details of the Alert in a Div element configured in the `alertContainer` property.

### `alertContainer`

Div where Alerts can appear

  [`AdaptableContainerValue`](https://www.adaptabletools.com/docs/reference/adaptablecontainervalue.md)

Name of the Div where [Alerts](https://www.adaptabletools.com/docs/handbook-alerting/index.md) can be displayed.

The property can be the Id (string) of the Div, a CSS Selector, or the HTMLElement itself.

And it can either be returned directly:

```ts {3}
const adaptableOptions: AdaptableOptions = {
  containerOptions: {
    alertContainer: 'myAlertContainer',
  },
};
```

or via a function:

```ts {3}
const adaptableOptions: AdaptableOptions = {
  containerOptions: {
    alertContainer: (context: ContainerContext) => {
      return document.getElementById('myAlertContainer');
    },
  },
};
```

## Modal Container

AdapTable, by default, displays the Settings Panel and Wizards (e.g. Format Column, Bulk Update) above the Grid, as either a centred modal or a draggable window (as set by the `popupType` property in [Settings Panel Options](https://www.adaptabletools.com/docs/reference/settingspaneloptions.md) and [Wizard Options](https://www.adaptabletools.com/docs/reference/wizardoptions.md)).

If this is not required behaviour, the `modalContainer` property can specify an alternative location.

### `modalContainer`

Div in which the Settings Panel and Wizards are rendered

  [`AdaptableContainerValue`](https://www.adaptabletools.com/docs/reference/adaptablecontainervalue.md)

Name of the Div which contains the Settings Panel and Wizards.

The property can be the Id (string) of the Div, a CSS Selector, or the HTMLElement itself.

When `modalContainer` is set, it takes precedence over `popupType`: the Settings Panel and Wizards are rendered inline inside the provided Div (neither as a modal, nor as a draggable window)

And it can either be returned directly:

```ts {3}
const adaptableOptions: AdaptableOptions = {
  containerOptions: {
    modalContainer: 'myModalContainer',
  },
};
```

or via a function:

```ts {3}
const adaptableOptions: AdaptableOptions = {
  containerOptions: {
    modalContainer: (context: ContainerContext) => {
      return document.getElementById('myModalContainer');
    },
  },
};
```

## System Status Container

AdapTable offers [System Status Messages](https://www.adaptabletools.com/docs/handbook-system-status-message/index.md) which will display important messages to run time users.

These can be displayed in various locations in the AdapTable UI, including in a custom div specified by using the `systemStatusContainer` property.

### `systemStatusContainer`

Div where System Status messages can appear

  [`AdaptableContainerValue`](https://www.adaptabletools.com/docs/reference/adaptablecontainervalue.md)

Name of the Div where [System Status](https://www.adaptabletools.com/docs/ui-tutorial-using-toast-notifications/index.md) messages can be displayed.

The property can be the Id (string) of the Div, a CSS Selector, or the HTMLElement itself.

And it can either be returned directly:

```ts {3}
const adaptableOptions: AdaptableOptions = {
  containerOptions: {
    systemStatusContainer: 'mySystemStatusContainer',
  },
};
```

or via a function:

```ts {3}
const adaptableOptions: AdaptableOptions = {
  containerOptions: {
    systemStatusContainer: (context: ContainerContext) => {
      return document.getElementById('mySystemStatusContainer');
    },
  },
};
```

## Transposed View Container

AdapTable supports [displaying a transposed view](https://www.adaptabletools.com/docs/handbook-transposing/index.md) of AG Grid data.

By default AdapTable displays the transposed content (grid and column selector) in a popup above AG Grid.

However developers can choose to display the Transposed View in any container of their choice by using the `transposedViewContainer` property.

- Transposed View content is rendered directly into this container **without** the default popup window chrome
- This means that, by default, no header or close button are displayed, and the window is not draggable

The container is responsible for its own lifecycle; removing it from the DOM will cleanly unmount the Transposed View

### `transposedViewContainer`

Div where Transposed Views are displayed

  [`AdaptableContainerValue`](https://www.adaptabletools.com/docs/reference/adaptablecontainervalue.md)

The property can be the Id (string) of the Div, a CSS Selector, or the HTMLElement itself.

And it can either be returned directly:

```ts {3}
const adaptableOptions: AdaptableOptions = {
  containerOptions: {
    transposedViewContainer: 'myTransposedViewContainer',
  },
};
```

or via a function:

```ts {3}
const adaptableOptions: AdaptableOptions = {
  containerOptions: {
    transposedViewContainer: (context: ContainerContext) => {
      return document.getElementById('myTransposedViewContainer');
    },
  },
};
```

The full property list is in the [Container Technical Reference](https://www.adaptabletools.com/docs/technical-reference-container/index.md)
