# Configuring the Status Bar

Canonical page: https://www.adaptabletools.com/docs/ui-status-bar-configuring

- How to register `AdaptableStatusPanel` in AG Grid and wire [Status Bar Initial State](https://www.adaptabletools.com/docs/technical-reference-status-bar/index.md)
- Typical pattern when replacing or supplementing the [Dashboard](https://www.adaptabletools.com/docs/ui-dashboard/index.md)

Status Bars are configured by developers at design time.

This requires configuring both AG Grid `GridOptions` and AdapTable's [Adaptable Options](https://www.adaptabletools.com/docs/technical-reference-adaptable-options/index.md)

Developers are able to configure 3 main elements of the Status Bar:

- how many Status Bars (if any) are displayed
- where they are displayed
- the initial contents of each Status Bar

## Defining the Status Bar

2 steps are required when defining Adaptable Status Bars:

- Register the Status Bars in the `statusBar` property of AG Grid GridOptions
- Define the Status Bar Panels in [Status Bar Initial State](https://www.adaptabletools.com/docs/technical-reference-status-bar/index.md).

### Guide to Defining the AdapTable Status Bar

There are 2 steps required to include AdapTable Status Panels in the AG Grid Status Bar:

In the `statusBar` property of Grid Options, populate the `statusPanel` property with a collection of StatusPanels.

Add as many AdaptableStatusPanels as required.

There are 3 properties to set:

- `statusPanel` - should always have the value: 'AdaptableStatusPanel'
- `align` - can be: 'left', 'right' or 'center'
- `key` - the unique identifier for the Status Panel (required — AdapTable cannot manage the region without it)

You can still add AG Grid Status Panels if required

Each `AdaptableStatusPanel` entry **must** have a stable `key`. The same value is used as `Key` in Status Bar Initial State.

```ts {7,8,9,12,13,14,17,18,19}
export const gridOptions: GridOptions = {
  statusBar: {
    statusPanels: [
      {statusPanel: 'agTotalRowCountComponent', align: 'left'},
      {statusPanel: 'agFilteredRowCountComponent'},
      {
        key: 'Left Panel',
        statusPanel: 'AdaptableStatusPanel',
        align: 'left',
      },
      {
        key: 'Center Panel',
        statusPanel: 'AdaptableStatusPanel',
        align: 'center',
      },
      {
        key: 'Right Panel',
        statusPanel: 'AdaptableStatusPanel',
        align: 'right',
      },
    ],
  },
};
```

Define the StatusPanels in the StatusBar section.

You can provide as many Status Bars as required.

Each Status Bar has 2 properties:

- `Key` - Use the same property for Key as used for key in Grid Options

- This value is (lower case) `key` in AG Grid Grid Options
- But (upper case) `Key` in Adaptable State
  

- `StatusBarPanels` - a list of which Panels you want 

  
Each [Module](https://www.adaptabletools.com/docs/technical-reference-adaptable-modules/index.md) has either a dedicated Panel (e.g. Theme) or a button which opens its [Settings Panel](https://www.adaptabletools.com/docs/ui-settings-panel/index.md) page

```ts {5,15,19}
const initialState: InitialState = {
   StatusBar: {
      StatusBars: [
        {
          Key: 'Left Panel',
          StatusBarPanels: [
            'Export',
            'DataSet',
            'CellSummary',
            'Alert',
            'Layout',
          ],
        },
        {
          Key: 'Center Panel',
          StatusBarPanels: ['ColumnFilter', 'GridFilter'],
        },
        {
          Key: 'Right Panel',
          StatusBarPanels: ['QuickSearch', 'Theme',],
        },
      ],
    },
};
```

**Example: Status Bar replacing Dashboard**

Using the Status Bar to replace the Dashboard

- This demo shows how you can use the Adaptable Status Bar to remove the Dashboard — useful when screen estate is tight:
  - Quick Search and Layout are in the Status Bar (together with AG Grid Row Count)
  - The Dashboard has been hidden completely

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts
  index.ts             [template]
  onAdaptableReady.ts
  rowData.ts           [template]
  styles.css           [template]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Quick Search Status Bar',
  initialState: {
    Dashboard: {
      IsHidden: true,
    },
    StatusBar: {
      StatusBars: [
        {
          Key: 'Adaptable Center Panel',
          StatusBarPanels: ['QuickSearch'],
        },
        {
          Key: 'Adaptable Right Panel',
          StatusBarPanels: ['Layout'],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Grouped Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'language',
            'github_stars',
            'license',
            'open_issues_count',
            'closed_issues_count',
            'open_pr_count',
            'closed_pr_count',
            'updated_at',
            'pushed_at',
            'github_watchers',
            'has_projects',
            'has_pages',
            'week_issue_change',
          ],
          AutoSizeColumns: true,
        },
        {
          Name: 'Grouped Layout',
          TableColumns: [
            'name',
            'language',
            'open_issues_count',
            'week_issue_change',
          ],
          RowGroupedColumns: ['language'],
          AutoSizeColumns: true,
        },
      ],
    },
  },
};
```

**`src/gridOptions.ts`**

```ts
import {GridOptions, themeBalham} from 'ag-grid-enterprise';
import {rowData} from './rowData';
import {columnDefs} from './columnDefs';

export const gridOptions: GridOptions = {
  theme: themeBalham,
  defaultColDef: {
    resizable: true,

    sortable: true,
    editable: true,
    filter: true,
    floatingFilter: true,
  },
  columnDefs: columnDefs,
  rowData: rowData,
  sideBar: true,

  statusBar: {
    statusPanels: [
      {statusPanel: 'agTotalRowCountComponent', align: 'left'},
      {
        key: 'Adaptable Center Panel',
        statusPanel: 'AdaptableStatusPanel',
        align: 'center',
      },
      {
        key: 'Adaptable Right Panel',
        statusPanel: 'AdaptableStatusPanel',
        align: 'right',
      },
    ],
  },
  suppressMenuHide: true,
  cellSelection: true,
};
```

**`src/onAdaptableReady.ts`**

```ts
import {AdaptableReadyInfo} from '@adaptabletools/adaptable';

export const onAdaptableReady = ({adaptableApi}: AdaptableReadyInfo) => {
  setTimeout(() => {
    adaptableApi.quickSearchApi.runQuickSearch('javascript');
  }, 100);
};
```
