# Configuring the Dashboard

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

- The Dashboard is extremely configurable - both for run-time and design-time users
- Each element can be precisely set to meet the requirements of each app and user

Because the Dashboard is so personal to each AdapTable instance it is fully flexible and configurable.

## Design Time Configuration

Design-time developers can configure all the properties in the Dashboard to meet their precise requirements.

Dashboard Configuration is achieved through a mixture of [Initial Adaptable State](https://www.adaptabletools.com/docs/dev-guide-adaptable-state-initial-state/index.md) and [Adaptable Options](https://www.adaptabletools.com/docs/technical-reference-adaptable-options/index.md) as follows:

| Dashboard Feature                 | Provided                                                                                                                                                                  |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Tabs and (System) Module Toolbars | [Dashboard Initial State](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md)                                                                                    |
| Pinned Toolbars                   | [Dashboard Initial State](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md)                                                                                    |
| Custom Toolbars                   | [Dashboard Initial State](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md) & [Dashboard Options](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md) |
| Module Buttons                    | [Dashboard Initial State](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md)                                                                                    |
| Custom Buttons                    | [Dashboard Options](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md)                                                                                          |
| Buttons Location                  | [Dashboard Options](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md)                                                                                          |
| Dashboard Modes                   | [Dashboard Initial State](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md)                                                                                    |
| Dashboard Header Text             | [Dashboard Initial State](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md)                                                                                    |
| Application Icon                  | [User Interface Options](https://www.adaptabletools.com/docs/technical-reference-ui/index.md)                                                                                               |
| Quick Search Input                | [Dashboard Options](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md)                                                                                          |

- Tabs, Toolbars, Buttons and Dashboard Modes are discussed in other pages in this section
- We will look at each of the other 4 options below

### Configuring the Dashboard at Design Time

There are a number of different, optional, properties than can be provided in [Dashboard Initial State](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md) and [Dashboard Options](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md):

By default **no** Module Buttons are listed in `ModuleButtons`. The Dashboard always shows a **Home control** that opens the [Settings Panel](https://www.adaptabletools.com/docs/ui-settings-panel/index.md) — it is not a Module Button.

In Initial Adaptable State:

- Use `ModuleButtons` to add Module Buttons if needed
- Or provide an empty array to show no Module Buttons (the Home control still appears unless Settings Panel is *Hidden*)

In Dashboard Options:

- Provide any Custom Dashboard Buttons that should be displayed
- Set whether buttons appear on right (default) or left

By default no Tabs are displayed.

In Initial Adaptable State:

- Provide list of Module and Custom Toolbars organised by Tabs
- Specify any Pinned Toolbars
- Each Toolbar should appear in only one Tab
- `TabIndex` property sets which Tab opens when Application starts

In Dashboard Options:

- Define any Custom Toolbars which are available

- You can change how the Dashboard will appear by configuring the Initial State
- You can set one of the View Properties:
  - `IsCollapsed` - only header of Dashboard is visible
  - `IsFloating` - Dashboard floats and snaps back on double-click (or provide `FloatingPosition` coordinate)
  - `IsHidden` - Dashboard is invisible

Use `DashboardTitle` to give Dashboard a bespoke name.
If unsupplied, `adaptableId` value in [Base Options](https://www.adaptabletools.com/docs/technical-reference-adaptable-options/index.md) is used.

Provide an Icon for the Application - by using the `applicationIcon` property in [User Interface Options](https://www.adaptabletools.com/docs/technical-reference-ui/index.md)

Set `showQuickSearchInHeader` in [Dashboard Options](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md) to false if you wish to hide the Quick Search Input (visible by default)

```jsx [[1, 7, "customDashboardButtons"], [1, 6, "buttonsLocation"], [1, 57, "ModuleButtons"], [2, 24, "customToolbars"], [2, 47, "Tabs"], [2, 59, "ActiveTabIndex"], [2, 61, "PinnedToolbars"], [3, 58, "IsCollapsed"], [4, 60, "DashboardTitle"], [5, 41, "applicationIcon"], [6, 5, "showQuickSearchInHeader"]]
export const adaptableOptions: AdaptableOptions = {
  primaryKey: 'id',
  adaptableId: 'AdapTable Dashboard',
  dashboardOptions: {
    showQuickSearchInHeader: false,
    buttonsLocation: 'left',
    customDashboardButtons: [
      {
        label: (
          button: AdaptableButton<DashboardButtonContext>,
          context: DashboardButtonContext
        )=> {
          return 'Set Dark Theme'
        },
        onClick: (
            button: AdaptableButton<DashboardButtonContext>,
            context: DashboardButtonContext
        )=> {
          context.adaptableApi.themeApi.loadDarkTheme()
        },
        buttonStyle: { tone: 'accent', variant: 'raised' },
      },
    ],
    customToolbars: [
      {
        name: 'ButtonToolbar',
        title: 'Buttons',
        toolbarButtons: [
          {
            label: 'Show Current Time',
            onClick: (button: AdaptableButton<CustomToolbarButtonContext>, context: CustomToolbarButtonContext) => {
              context.adaptableApi.alertApi.showAlertInfo('Current Time', new Date().toTimeString());
            },
            buttonStyle: { tone: 'info', variant: 'text' },
          },
        ],
      },
    ],
  },
  userInterfaceOptions: {
    applicationIcon: {
      src: 'https://img.icons8.com/color/100px/bungalow',
    },
  },
  initialState: {
    Dashboard: {
      Tabs: [
        {
          Name: 'Search',
          Toolbars: ['ColumnFilter', 'DataSet', 'QuickSearch'],
        },
        {
          Name: 'Custom Tab',
          Toolbars: ['DataChangeHistory', 'ButtonToolbar'],
        },
      ],
      ModuleButtons: ['FormatColumn', 'Shortcut' ],
      IsCollapsed: true,
      ActiveTabIndex: 1,
      DashboardTitle: "CRM Monitor",
      PinnedToolbars: ["Query"]
    },
  },
};
```

### Buttons Location

By default any Module (or Custom) Buttons are displayed on the right of the Dashboard - next to the Quick Search Input.

Alternatively the `buttonsLocation` property of [Dashboard Options](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md) can be used to render them on the left.

### Quick Search Input

The Quick Search Input performs a simple text search across all visible columns in AG Grid.

This is done using the [Quick Search](https://www.adaptabletools.com/docs/handbook-quick-search/index.md) Module.

The Input is visible by default but by can be hidden by setting the `showQuickSearchInHeader` property of [Dashboard Options](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md) to false.

### `showQuickSearchInHeader`

Shows Quick Search textbox in the Dashboard Header

By default AdapTable will display a [Quick Search](https://www.adaptabletools.com/docs/handbook-quick-search/index.md) input box in the Dashboard.

By default this appears in the top left corner of the Dashboard.

- The Quick Search Entitlement takes precedence over this property
- If that is set to `Hidden` the input will not display, irrespective of the value of this property

```ts {4}
// Don't show the Quick Search Header in the Dashboard
const adaptableOptions: AdaptableOptions = {
  dashboardOptions: {
    showQuickSearchInHeader: false,
  },
};
```

### Dashboard Header Text

The Dashboard's Header Text is set via the set via `DashboardTitle` property in [Dashboard Initial State](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md).

If not explicitly provided, the value of the `adaptableId` property in [Adaptable Options](https://www.adaptabletools.com/docs/technical-reference-adaptable-options/index.md) is used

### Application Icon

If an Application Icon is provided, AdapTable displays it in the Dashboard (as well as in [Toast Notifications](https://www.adaptabletools.com/docs/ui-tutorial-using-toast-notifications/index.md)).

- Application Icons are of the common [Adaptable Icon](https://www.adaptabletools.com/docs/ui-tutorial-creating-icon/index.md) object type
- They are provided via the `applicationIcon` property in [User Interface Options](https://www.adaptabletools.com/docs/technical-reference-ui/index.md)

**Example: Dashboard: Configuring**

Configuring the AdapTable Dashboard

- This example shows some ways of configuring the AdapTable Dashboard including:
  - setting `showQuickSearchInHeader` to _false_ in [Dashboard Options](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md) to hide the Quick Search Input
  - providing an Application Icon in [User Interface Options](https://www.adaptabletools.com/docs/technical-reference-ui/index.md)
  - configuring the `buttonsLocation` [Dashboard Options](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md) so that Buttons are displayed on the Left
  - setting the Dashboard Title explicitly in [Dashboard Initial State](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md)
### Expand to see the Dashboard configuration provided

```ts
dashboardOptions: {
  showQuickSearchInHeader: false,
  buttonsLocation: 'left',
},
userInterfaceOptions: {
  applicationIcon: {
    src: 'https://img.icons8.com/color/100px/bungalow',
  },
},
initialState: {
  Dashboard: {
    DashboardTitle: 'Configuring the Dashboard',
    ModuleButtons: [
      'FormatColumn',
      'DataChangeHistory',
      'CalculatedColumn',
      'Shortcut',
    ],
  },
},
```

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

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  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: 'Dashboard Configure Demo',
  dashboardOptions: {
    showQuickSearchInHeader: false,
    buttonsLocation: 'left',
  },
  userInterfaceOptions: {
    applicationIcon: {
      src: 'https://img.icons8.com/color/100px/bungalow',
    },
  },
  initialState: {
    Dashboard: {
      DashboardTitle: 'Configuring the Dashboard',
      ModuleButtons: [
        'FormatColumn',
        'DataChangeHistory',
        'CalculatedColumn',
        'Shortcut',
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          TableColumns: [
            'name',
            'language',
            'github_stars',
            'license',
            'has_projects',
            'has_pages',
            'created_at',
            'has_wiki',
            'updated_at',
            'pushed_at',
            'github_watchers',
            'week_issue_change',
          ],
          Name: 'Standard Layout',
          AutoSizeColumns: true,
        },
      ],
    },
  },
};
```

## Run Time Configuration

Run Time users are able to re-configure their Dashboard if needed.

This is, of course, dependent on the run-time user having the correct [Entitlements](https://www.adaptabletools.com/docs/handbook-permissioning/index.md)

In particular they can use the Dashboard section of the [Settings Panel](https://www.adaptabletools.com/docs/ui-settings-panel/index.md) to:

- Create / Edit / Delete Tabs
- Decide which Toolbars are visible and placed into which Tab
- Manage Pinned Toolbars
- Configure the order and visibility of Module (but not Custom) Dashboard Buttons
- Switch between Dashboard Modes

- Run-time users cannot create Custom Toolbars or Custom Dashboard Buttons
- They can set visibility and Tab placement of Custom Toolbars, but not Custom Dashboard Buttons

### Switching Dashboard Modes

AdapTable allows run-time to switch between the available Dashboard modes in multiple ways, including:

- **Manually in the UI** - users can Collapse / Expand the Dashboard by clicking on the active Tab, or Float / Dock the Dashboard by double-clicking the Title in the Dashboard Header

- A _Dashboard_ **Menu Item** in both [Column](https://www.adaptabletools.com/docs/ui-column-menu/index.md) and [Context](https://www.adaptabletools.com/docs/ui-context-menu/index.md) Menus enables all Dashboard Modes to be selected

- A _Dashboard_ **Tool Panel** in the [AdapTable Tool Panel](https://www.adaptabletools.com/docs/ui-tool-panel/index.md) contains `Collapse`, `Float` and `Hidden` checkboxes

### Configuring the Dashboard using Settings Panel

The following configuration is possible in the Dashboard section of the Settings Panel:

The `Dashboard Modes` section contains 3 checkboxes:

- `Collapse` - Collapses / Expands the Toolbars
- `Float` - Floats / Docks the Dashboard
- `Hidden` - Hides / Shows the Dashboard

The `Tabbed Toolbars` radio option of the `Dashboard Contents` section is for managing Dashboard Tabs and associated Toolbars.

It contains a list of all Tabs with the constituent Toolbars.

To _create_ a new Tab:

- click 'Add Tab' to create a new Tab
- change the Name from 'New Tab' to something more suitable
- drag Toolbars from the `Available Toolbars` panel into the Tab
- this will include any Custom Toolbars which have been provided to the Application

To _edit_ a Tab:

- either add Toolbars by dragging them from the `Available Toolbars` panel
- or remove Toolbars by clicking the 'x'

To _delete_ a Tab:

- click the Delete (dustbin) icon next to the Tab's name

To _re-order_ Tabs:

- drag the icon in the left corner of the Tab to place it in a different position

The `Pinned Toolbars` radio option of the `Dashboard Contents` section is for selecting which Toolbars will be pinned above the Grid (as opposed to placed in Tabs - see step above).

It contains a list of all Toolbars - including any Custom Toolbars provided.

Simply drag Toolbars from the `Available Pinned Toolbars` panel into the `Pinned Toolbars` Tab and then re-order as required.

Click the `Buttons` radio option to set which [Module Buttons](https://www.adaptabletools.com/docs/ui-dashboard-buttons/index.md#module-buttons) are visible.

The panel shows a list of all available Module Buttons.

The list does not include any [Custom Buttons](https://www.adaptabletools.com/docs/ui-dashboard-buttons/index.md#custom-buttons) - as they cannot be hidden at run-time

Check the Module Buttons that should be visible.

Drag the checked items into their desired position to set the Buttons' order.

## CSS Configuration

Everything in AdapTable is fully [themable](https://www.adaptabletools.com/docs/handbook-theming/index.md) using [CSS Variables](https://www.adaptabletools.com/docs/handbook-theming-custom/index.md).

This allows developer complete control over the look and feel of the Application - including the Dashboard.

**Example: Dashboard: Stacking Toolbars**

Stacking Toolbars in the Dashboard

- By default all Toolbars (in the Active Tab) are shown in a long horizontal row.
- This means scrolling to the right is required if the Toolbars take up more space than the grid or enclosing window.
- However, as this demo illustrates, it can be easily 'fixed' by setting one of the many [CSS Variables](https://www.adaptabletools.com/docs/handbook-theming-custom/index.md) made available by AdapTable.
### Expand to see the CSS

Toolbars can be wrapped by setting the `--ab-dashboard-wrap` [CSS Variable](https://www.adaptabletools.com/docs/handbook-theming-custom/index.md) to wrap (default is `nowrap`):
```
--ab-dashboard-wrap: wrap
```
A relevant CSS Variable we have also set here is `--ab-dashboard-gap-size` which controls the gap between Toolbars:
```
--ab-dashboard-gap-size: 2px
```

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

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts           [template]
  styles.css           [template + shown below]
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: 'Dashboard Stacked Toolbars',
  initialState: {
    Dashboard: {
      Tabs: [
        {
          Name: 'Stacked Toolbars',
          Toolbars: [
            'GridFilter',
            'Export',
            'Layout',
            'Alert',
            'SystemStatus',
            'CellSummary',
            'DataChangeHistory',
            'QuickSearch',
            'Theme',
            'SystemStatus',
          ],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          TableColumns: [
            'name',
            'language',
            'github_stars',
            'license',
            'has_projects',
            'has_pages',
            'created_at',
            'has_wiki',
            'updated_at',
            'pushed_at',
            'github_watchers',
            'week_issue_change',
          ],
          Name: 'Standard Layout',
          AutoSizeColumns: true,
        },
      ],
    },
  },
};
```

**`src/styles.css`**

```css
:root {
  --ab-dashboard-wrap: wrap;
  --ab-dashboard-gap-size: 2px;
}
```
