# Module Tool Panels

Canonical page: https://www.adaptabletools.com/docs/ui-tool-panel-module-tool-panels

- Module ToolPanels are System ToolPanels provided by AdapTable
- Each Module ToolPanel contains UI elements specific to that Module
- For instance Layout has a Layout Selector and an Edit button
- Both developers and end users can set the visibility and order of the Module Tool Panels

AdapTable provides a Tool Panel for those Modules where items can be selected, switched, configured etc.

The full list of Module ToolPanels is:

- [Alerts](https://www.adaptabletools.com/docs/handbook-alerting/index.md)
- [Bulk Update](https://www.adaptabletools.com/docs/handbook-editing-bulk-update/index.md)
- [Cell Summary](https://www.adaptabletools.com/docs/handbook-summarising/index.md)
- [Charts](https://www.adaptabletools.com/docs/handbook-charts/index.md)
- [Column Filters](https://www.adaptabletools.com/docs/handbook-column-filter/index.md)
- [Dashboard](https://www.adaptabletools.com/docs/ui-dashboard/index.md)
- [Data Change History](https://www.adaptabletools.com/docs/handbook-monitoring-data-change-history/index.md)
- [Export](https://www.adaptabletools.com/docs/handbook-exporting/index.md)
- [Grid Filter](https://www.adaptabletools.com/docs/handbook-grid-filter/index.md)
- [Layout](https://www.adaptabletools.com/docs/handbook-layouts/index.md)
- [Quick Search](https://www.adaptabletools.com/docs/handbook-quick-search/index.md)
- [Smart Edit](https://www.adaptabletools.com/docs/handbook-editing-smart-edit/index.md)
- [State Management](https://www.adaptabletools.com/docs/dev-guide-adaptable-state-management/index.md)
- [System Status Messages](https://www.adaptabletools.com/docs/handbook-system-status-message/index.md)
- [Theme](https://www.adaptabletools.com/docs/handbook-theming/index.md)

## Configuring Module ToolPanels

Developers can specify in [Tool Panel Initial State](https://www.adaptabletools.com/docs/technical-reference-tool-panel/index.md) which Module ToolPanels should be visible at start-up and whether they should display as open or closed.

### Configuring Module ToolPanels

By default all Module ToolPanels (to which the user is entitled) are visible at start-up and will display in alphabetical order.

This can be overridden by providing in the `ToolPanels` property a separate list of ToolPanels which should be displayed instead.

Module ToolPanels not listed here but to which the user is entitled can later be made visible at run-time

```ts {6,9,12}
// Show only the Alert, Layout and SmartEdit ToolPanels
const initialState: InitialState = {
  ToolPanel: {
    ToolPanels: [
      {
        Name: 'Alert',
      },
      {
        Name: 'Layout',
      },
      {
        Name: 'SmartEdit',
      },
    ],
  },
};
```

All Module ToolPanels show as _collapsed_ at application startup.

This means you can see the ToolPanel header but you need to click on the little arrow to view the full contents.

This can be changed by setting the `VisibilityMode` to be _expanded_ for those ToolPanels which should display as open.

This is stored in Adaptable State so any run-time changes will be automatically persisted.

```ts {11,16}
const initialState: InitialState = {
  ToolPanel: {
    ToolPanels: [
      {
        // Will be collapsed (as is the default)
        Name: 'Alert',
      },
      {
        Name: 'Layout',
        // Set it to be expanded at startup
        VisibilityMode: 'expanded',
      },
      {
        Name: 'SmartEdit',
        // Ensure it is collapsed
        VisibilityMode: 'collapsed',
      },
    ],
  },
};
```

**Example: Module ToolPanels**

Configuring Module ToolPanels

- This example limits the number of Module Tool Panels to 5:
  - `Alert`, `Theme` - which are set as closed
  - `CellSummary`, `Export` and `Layout` - which are set as expanded

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
  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: 'Module Tool Panels',
  entitlementOptions: {
    moduleEntitlements: [
      {adaptableModule: 'ToolPanel', accessLevel: 'ReadOnly'},
    ],
  },
  initialState: {
    ToolPanel: {
      ToolPanels: [
        {
          Name: 'Alert',
          VisibilityMode: 'collapsed',
        },
        {
          Name: 'CellSummary',
          VisibilityMode: 'expanded',
        },
        {
          Name: 'Export',
          VisibilityMode: 'expanded',
        },
        {
          Name: 'Layout',
          VisibilityMode: 'collapsed',
        },
        {
          Name: 'Theme',
          VisibilityMode: 'expanded',
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'language',
            'github_stars',
            'license',
            'created_at',
            'has_wiki',
            'updated_at',
            'pushed_at',
            'github_watchers',
            'description',
            'open_issues_count',
            'closed_issues_count',
            'open_pr_count',
            'closed_pr_count',
            'has_projects',
            'has_pages',
            'week_issue_change',
          ],
        },
      ],
    },
  },
};
```

**`src/onAdaptableReady.ts`**

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

export const onAdaptableReady = ({adaptableApi}: AdaptableReadyInfo) => {
  adaptableApi.toolPanelApi.openAdapTableToolPanel();
};
```
