# Custom Settings Panels

Canonical page: https://www.adaptabletools.com/docs/ui-settings-panel-custom

- Developers can add bespoke panels to the Settings Panel via [Settings Panel Options](https://www.adaptabletools.com/docs/technical-reference-settings-panel/index.md)
- Each panel supplies and renders custom content

Developers can add custom panels to the Settings Panel.

This allows users to manage AdapTable and application settings in one place

Custom panels are provided using the `customSettingsPanels` property in [Settings Panel Options](https://www.adaptabletools.com/docs/technical-reference-settings-panel/index.md).

### Anatomy of a Custom Settings Panel

The [`CustomSettingsPanel`](https://www.adaptabletools.com/docs/reference/customsettingspanel.md) object is defined as follows:

| Property | Type | Description |
| --- | --- | --- |
| [description](https://www.adaptabletools.com/docs/reference/customsettingspanel.md#description) | `string` | Short subtitle shown under the name in Settings Panel navigation. |
| [frameworkComponent](https://www.adaptabletools.com/docs/reference/customsettingspanel.md#frameworkcomponent) | [`AdaptableFrameworkComponent`](https://www.adaptabletools.com/docs/reference/adaptableframeworkcomponent.md) | Framework-specific (Angular, React or Vue) component to be rendered |
| [icon](https://www.adaptabletools.com/docs/reference/customsettingspanel.md#icon) | [`AdaptableIcon`](https://www.adaptabletools.com/docs/reference/adaptableicon.md) | Icon rendered inside settings-panel name, inside the navigation |
| [name](https://www.adaptabletools.com/docs/reference/customsettingspanel.md#name) | `string` | Appears in Settings Panel Navigation. Include in `navigation` to choose placement<br/>(by default added to a `Custom Panels` group at the end). |
| [render](https://www.adaptabletools.com/docs/reference/customsettingspanel.md#render) | `(customRenderContext: `[`CustomRenderContext`](https://www.adaptabletools.com/docs/reference/customrendercontext.md)`) => string \| null` | Function to provide bespoke content when NOT using a Framework wrapper |

- `name` — shown in the left-hand navigation; include in `navigation` groups when you define a custom order
- `description` — optional short subtitle shown under the name
- `icon` — optional [`AdaptableIcon`](https://www.adaptabletools.com/docs/reference/adaptableicon.md) for the nav entry
- `render` or `frameworkComponent` — bespoke panel content (one or the other, depending on flavour)

## Providing Bespoke Content

<!-- framework: vanilla -->
### Vanilla

Provide bespoke content with `render` on [`CustomSettingsPanel`](https://www.adaptabletools.com/docs/reference/customsettingspanel.md).

The function receives [`CustomRenderContext`](https://www.adaptabletools.com/docs/reference/customrendercontext.md) (`phase`, `element`, `adaptableApi`).

```ts
render?: (context: CustomRenderContext) => string | null;
```

Return HTML when `phase` is `'onMount'`; return `null` on `'onDestroy'` for teardown.

### Providing a Custom Settings Panel (Vanilla)

Add an entry to `customSettingsPanels` with `name`, an optional `description` (shown under the name), an optional `icon`, and `render`.

Use the `navigation` configurer to return grouped navigation — each group has a `label` (optional heading) and `items` (module or custom panel names).

```ts [[1, 2, "customSettingsPanels"], [1, 4, "name"], [1, 5, "description"], [1, 7, "render"], [2, 19, "navigation:"]]
settingsPanelOptions: {
  customSettingsPanels: [
    {
      name: 'Application Settings',
      description: 'Configure application-wide options',
      icon: {name: 'info'},
      render: context => {
        if (context.phase === 'onMount') {
          return `
            <h3>Application Settings</h3>
            <p>Configure application-wide options here.</p>
            <label>Number of agents: <input type="text" placeholder="Enter count" /></label>
          `;
        }
        return null;
      },
    },
  ],
  navigation: (_context, _defaultNavigation) => ({
    groups: [
      {label: 'Settings', items: ['Application Settings']},
      {label: 'Work', items: ['CalculatedColumn', 'FormatColumn']},
      {label: 'Admin', items: ['Theme']},
    ],
  }),
},
```

`render` returns HTML, so the panel uses a **Switch Theme** button.

Listen on the container element. The HTML is inserted after `render` returns, and the click bubbles up to that element.

```ts [[1, 2, "name: 'Theme Switcher'"], [1, 10, "addEventListener"], [1, 29, "Switch Theme"]]
{
  name: 'Theme Switcher',
  description: 'The custom theme',
  icon: {name: 'theme'},
  render: context => {
    if (context.phase !== 'onMount') {
      return null;
    }
    const {element, adaptableApi} = context;
    element.addEventListener('click', (event: Event) => {
      const target = event.target;
      if (!(target instanceof HTMLElement) || !target.closest('button')) {
        return;
      }
      const themeApi = adaptableApi.themeApi;
      if (themeApi.getCurrentTheme() === 'dark') {
        themeApi.loadLightTheme();
      } else {
        themeApi.loadDarkTheme();
      }
      const label = element.querySelector('span');
      if (label) {
        label.textContent = themeApi.getCurrentTheme();
      }
    });
    return `
      <h3>Theme Switcher</h3>
      <p>Current Theme is <span>${adaptableApi.themeApi.getCurrentTheme()}</span></p>
      <button type="button" style="color:#fff;background:#2563eb;border:1px solid #2563eb;border-radius:4px;padding:6px 12px;">Switch Theme</button>
    `;
  },
}
```

**Example: Custom Settings Panel (Vanilla)**

Custom Settings Panel with HTML render and custom navigation

- **Theme Switcher** is the custom theme — a **Switch Theme** button toggles light and dark
- An **Application Settings** panel uses `render` with [`CustomRenderContext`](https://www.adaptabletools.com/docs/reference/customrendercontext.md) lifecycle
- `description` shows under each panel name in the navigation
- `navigation` places both custom panels at the top of the Settings Panel nav
- On load, [Settings Panel API](https://www.adaptabletools.com/docs/technical-reference-settings-panel/index.md) opens Theme Switcher

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, CustomRenderContext} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Custom Settings Panel',
  settingsPanelOptions: {
    icon: 'ApplicationIcon',
    title: 'Config Viewer',
    navigation: (_context, _defaultNavigation) => ({
      groups: [
        {label: 'Settings', items: ['Theme Switcher', 'Application Settings']},
        {label: 'Work', items: ['CalculatedColumn', 'FormatColumn']},
        {label: 'UI', items: ['Dashboard', 'ToolPanel']},
        {label: 'Administration', items: ['Alert', 'CustomSort', 'Export']},
        {label: 'Support', items: ['GridInfo', 'TeamSharing', 'Theme']},
      ],
    }),
    customSettingsPanels: [
      {
        name: 'Theme Switcher',
        description: 'The custom theme',
        icon: {name: 'theme'},
        render: (customRenderContext: CustomRenderContext) => {
          if (customRenderContext.phase !== 'onMount') {
            return null;
          }
          const {element, adaptableApi} = customRenderContext;
          if (element.dataset.themeSwitch !== 'ready') {
            element.dataset.themeSwitch = 'ready';
            element.addEventListener('click', (event: Event) => {
              const target = event.target;
              if (
                !(target instanceof HTMLElement) ||
                !target.closest('[data-name="switch-theme"]')
              ) {
                return;
              }
              const themeApi = adaptableApi.themeApi;
              if (themeApi.getCurrentTheme() === 'dark') {
                themeApi.loadLightTheme();
              } else {
                themeApi.loadDarkTheme();
              }
              const label = element.querySelector('[data-name="current-theme"]');
              if (label) {
                label.textContent = themeApi.getCurrentTheme();
              }
            });
          }
          return `
            <h3>Theme Switcher</h3>
            <p>Current Theme is <span data-name="current-theme">${adaptableApi.themeApi.getCurrentTheme()}</span></p>
            <button type="button" data-name="switch-theme" style="color:#fff;background:#2563eb;border:1px solid #2563eb;border-radius:4px;padding:6px 12px;">Switch Theme</button>
          `;
        },
      },
      {
        name: 'Application Settings',
        description: 'Configure application-wide options',
        icon: {name: 'info'},
        render: (customRenderContext: CustomRenderContext) => {
          if (customRenderContext.phase === 'onMount') {
            return `
              <h3>Application Settings</h3>
              <p>Configure application-wide options here.</p>
              <label>Number of agents: <input type="text" placeholder="Enter count" /></label>
            `;
          }
          return null;
        },
      },
    ],
  },
  initialState: {
    StatusBar: {
      StatusBars: [
        {
          Key: 'Center Panel',
          StatusBarPanels: ['SettingsPanel'],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'github_stars',
            'language',
            'week_issue_change',
            'description',
            'created_at',
            'has_wiki',
            'pushed_at',
            'open_issues_count',
          ],
          AutoSizeColumns: true,
        },
      ],
    },
  },
};
```

**`src/onAdaptableReady.ts`**

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

export const onAdaptableReady = ({adaptableApi}: AdaptableReadyInfo) => {
  adaptableApi.settingsPanelApi.openCustomSettingsPanel('Theme Switcher');
};
```

<!-- /framework -->

<!-- framework: angular -->
### Angular

Provide bespoke content with `frameworkComponent` on [`CustomSettingsPanel`](https://www.adaptabletools.com/docs/reference/customsettingspanel.md) — typically `{ type: MyComponent }` for an Angular component.

See [Building Custom Components](https://www.adaptabletools.com/docs/ui-tutorial-building-custom-components/index.md) for `AngularFrameworkComponent` patterns

### Providing a Custom Settings Panel (Angular)

Create a component that uses [Adaptable API](https://www.adaptabletools.com/docs/technical-reference-adaptable-api/index.md) (for example via `ADAPTABLE_API`).

```ts
@Component({
  selector: 'theme-settings-panel',
  template: `
    <h3>Theme Switcher</h3>
    <p>Current Theme is {{ currentTheme }}</p>
    <div class="themeToggle">
      <span>Switch to </span>
      <slide-toggle></slide-toggle>
    </div>
  `,
  styles: [
    `
      .themeToggle {
        display: flex;
        gap: calc(var(--ab-base-space) * 2);
        align-items: center;
      }
    `,
  ],
})
export class ThemeSettingsPanelComponent implements AfterViewInit {
  @ViewChild(SlideToggleComponent) childSlideComponent: SlideToggleComponent;

  currentTheme: string;

  constructor(@Inject(ADAPTABLE_API) private adaptableApi: AdaptableApi) {
    this.currentTheme = this.adaptableApi.themeApi.getCurrentTheme();
    this.adaptableApi.eventApi.on('ThemeSelected', () => {
      this.currentTheme = this.adaptableApi.themeApi.getCurrentTheme();
    });
  }

  ngAfterViewInit() {
    this.childSlideComponent.onText = 'Light';
    this.childSlideComponent.offText = 'Dark';
    this.childSlideComponent.onChange = (toggleValue: boolean) => {
      toggleValue
        ? this.adaptableApi.themeApi.loadDarkTheme()
        : this.adaptableApi.themeApi.loadLightTheme();
    };
  }
}
```

Wire the component in `customSettingsPanels`, set an optional `description`, and list its `name` in `navigation` groups when you need a specific order.

```ts [[1, 2, "customSettingsPanels"], [1, 5, "description"], [1, 7, "frameworkComponent"], [2, 12, "navigation:"]]
settingsPanelOptions: {
  customSettingsPanels: [
    {
      name: 'Theme Switcher',
      description: 'The custom theme',
      icon: {name: 'theme'},
      frameworkComponent: {
        type: ThemeSettingsPanelComponent,
      },
    },
  ],
  navigation: (_context, _defaultNavigation) => ({
    groups: [
      {label: 'Settings', items: ['Theme Switcher']},
      {label: 'Work', items: ['CalculatedColumn', 'FormatColumn']},
      {label: 'Admin', items: ['Theme']},
    ],
  }),
},
```

**Example: Custom Settings Panel (Angular)**

Angular component as a Custom Settings Panel

- **Theme Switcher** is the custom theme — a theme label and a slide toggle wired to `themeApi`
- `description` shows under the panel name in the navigation
- Listed first in the custom `navigation` groups
- Opens on load via `settingsPanelApi.openCustomSettingsPanel`

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

```text
src/
  app/
    adaptableOptions.ts
    agGridModules.ts                   [template]
    app.component.ts                   [template]
    app.module.ts
    columnDefs.ts                      [template]
    gridOptions.ts                     [template]
    onAdaptableReady.ts
    rowData.ts                         [template]
    slide-toggle.component.ts
    styles.css                         [template]
    theme-settings-panel.component.ts
  index.html                           [template]
  main.ts                              [template]
  polyfills.ts                         [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#angular).

**`src/app/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable-angular-aggrid';
import {ThemeSettingsPanelComponent} from './theme-settings-panel.component';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Custom Settings Panel Demo',
  settingsPanelOptions: {
    customSettingsPanels: [
      {
        name: 'Theme Switcher',
        description: 'The custom theme',
        frameworkComponent: {
          // The custom component wraps the same reusable Angular toggle component which is used in the Toolbar and ToolPanel components
          type: ThemeSettingsPanelComponent,
        },
        icon: {
          name: 'theme',
        },
      },
    ],
    navigation: (_context, _defaultNavigation) => ({
      groups: [
        {label: 'Settings', items: ['Theme Switcher']},
        {label: 'Work', items: ['CalculatedColumn', 'FormatColumn']},
        {label: 'UI', items: ['Dashboard', 'ToolPanel']},
        {label: 'Administration', items: ['Alert', 'CustomSort', 'Export']},
        {label: 'Support', items: ['GridInfo', 'TeamSharing', 'Theme']},
      ],
    }),
  },
  initialState: {
    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/app/theme-settings-panel.component.ts`**

```ts
import {AfterViewInit, Component, Inject, ViewChild} from '@angular/core';
import {
  ADAPTABLE_API,
  AdaptableApi,
} from '@adaptabletools/adaptable-angular-aggrid';
import {SlideToggleComponent} from './slide-toggle.component';

@Component({
  selector: 'theme-settings-panel',
  standalone: false,
  template: `
    <h3>Theme Switcher</h3>
    <p>Current Theme is {{ currentTheme }}</p>
    <div class="themeToggle">
      <span>Switch to </span> <slide-toggle></slide-toggle>
    </div>
  `,
  styles: [
    `
      .themeToggle {
        display: flex;
        gap: calc(var(--ab-base-space) * 2);
        align-items: center;
      }
    `,
  ],
})
export class ThemeSettingsPanelComponent implements AfterViewInit {
  @ViewChild(SlideToggleComponent) childSlideComponent: SlideToggleComponent;

  currentTheme: string;

  constructor(@Inject(ADAPTABLE_API) private adaptableApi: AdaptableApi) {
    this.currentTheme = this.adaptableApi.themeApi.getCurrentTheme();
    this.adaptableApi.eventApi.on('ThemeSelected', () => {
      this.currentTheme = this.adaptableApi.themeApi.getCurrentTheme();
    });
  }

  ngAfterViewInit() {
    this.childSlideComponent.onText = 'Light';
    this.childSlideComponent.offText = 'Dark';
    this.childSlideComponent.onColor = '#c0ce28';
    this.childSlideComponent.offColor = '#01222c';

    this.childSlideComponent.onChange = (toggleValue: boolean) => {
      if (toggleValue) {
        this.adaptableApi.themeApi.loadDarkTheme();
      } else {
        this.adaptableApi.themeApi.loadLightTheme();
      }
    };
  }
}
```

**`src/app/slide-toggle.component.ts`**

```ts
import {
  ADAPTABLE_API,
  AdaptableApi,
} from '@adaptabletools/adaptable-angular-aggrid';
import {Component, Inject} from '@angular/core';

@Component({
  selector: 'slide-toggle',
  standalone: false,
  template: `
    <label class="switch">
      <input
        class="switch-input"
        type="checkbox"
        [checked]="active"
        (change)="onToggle()" />
      <span
        class="switch-label"
        [attr.data-on]="onText"
        [attr.data-off]="offText"
        [style.background]="active ? onColor : offColor"></span>
      <span class="switch-handle"></span>
    </label>
  `,
  styles: [
    `
      .switch {
        position: relative;
        display: block;
        width: 100px;
        height: 30px;
        padding: 3px;
        margin: 2px;
        background: -webkit-linear-gradient(top, #eeeeee, #ffffff 25px);
        border-radius: 18px;
        box-shadow:
          inset 0 -1px white,
          inset 0 1px 1px rgba(0, 0, 0, 0.05);
        cursor: pointer;
        box-sizing: content-box;
      }
      .switch-input {
        position: absolute;
        top: 0;
        left: 0;
        opacity: 0;
        box-sizing: content-box;
      }
      .switch-input:checked ~ .switch-label {
        box-shadow:
          inset 0 1px 2px rgba(0, 0, 0, 0.15),
          inset 0 0 3px rgba(0, 0, 0, 0.2);
      }
      .switch-input:checked ~ .switch-label:before {
        opacity: 0;
      }
      .switch-input:checked ~ .switch-label:after {
        opacity: 1;
      }
      .switch-input:checked ~ .switch-handle {
        left: 74px;
        box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2);
      }
      .switch-label {
        position: relative;
        display: block;
        height: inherit;
        background: #eceeef;
        font-size: 10px;
        text-transform: uppercase;
        border-radius: inherit;
        box-shadow:
          inset 0 1px 2px rgba(0, 0, 0, 0.12),
          inset 0 0 2px rgba(0, 0, 0, 0.15);
        box-sizing: content-box;
        transition: All 0.3s ease;
        -webkit-transition: All 0.3s ease;
        -moz-transition: All 0.3s ease;
        -o-transition: All 0.3s ease;
      }
      .switch-label:before {
        position: absolute;
        top: 50%;
        margin-top: -0.5em;
        line-height: 1;
        -webkit-transition: inherit;
        -moz-transition: inherit;
        -o-transition: inherit;
        transition: inherit;
        box-sizing: content-box;
        content: attr(data-off);
        right: 11px;
        color: #ffffff;
        text-shadow: 0 1px rgba(0, 0, 0, 0.2);
      }
      .switch-label:after {
        position: absolute;
        top: 50%;
        margin-top: -0.5em;
        line-height: 1;
        -webkit-transition: inherit;
        -moz-transition: inherit;
        -o-transition: inherit;
        transition: inherit;
        box-sizing: content-box;
        content: attr(data-on);
        left: 11px;
        color: #ffffff;
        text-shadow: 0 1px rgba(0, 0, 0, 0.2);
        opacity: 0;
      }
      .switch-handle {
        position: absolute;
        top: 4px;
        left: 4px;
        width: 28px;
        height: 28px;
        background: -webkit-linear-gradient(top, #ffffff 40%, #f0f0f0);
        border-radius: 100%;
        box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
        transition: All 0.3s ease;
        -webkit-transition: All 0.3s ease;
        -moz-transition: All 0.3s ease;
        -o-transition: All 0.3s ease;
      }
      .switch-handle:before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        margin: -6px 0 0 -6px;
        width: 12px;
        height: 12px;
        background: -webkit-linear-gradient(top, #eeeeee, #ffffff);
        border-radius: 6px;
        box-shadow: inset 0 1px rgba(0, 0, 0, 0.02);
      }
    `,
  ],
})
export class SlideToggleComponent {
  active = false;

  onText = 'ON';
  onColor = 'var(--ab-color-success)';

  offText = 'OFF';
  offColor = 'var(--ab-color-info)';

  constructor(@Inject(ADAPTABLE_API) private adaptableApi: AdaptableApi) {}

  onToggle() {
    this.active = !this.active;
    this.onChange(this.active);
  }

  onChange(toggleValue: boolean) {
    // overwritten in configuration
  }
}
```

**`src/app/onAdaptableReady.ts`**

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

export const onAdaptableReady = ({adaptableApi}: AdaptableReadyInfo) => {
  adaptableApi.settingsPanelApi.openCustomSettingsPanel(
    'Theme Switcher'
  );
};
```

**`src/app/app.module.ts`**

```ts
import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';

import {AgGridModule} from 'ag-grid-angular';
import {AdaptableAngularAgGridModule} from '@adaptabletools/adaptable-angular-aggrid';
import {AppComponent} from './app.component';
import {SlideToggleComponent} from './slide-toggle.component';
import {ThemeSettingsPanelComponent} from './theme-settings-panel.component';

@NgModule({
  declarations: [
    AppComponent,
    SlideToggleComponent,
    ThemeSettingsPanelComponent,
  ],
  imports: [BrowserModule, AgGridModule, AdaptableAngularAgGridModule],
  providers: [],
  bootstrap: [AppComponent],
  // @ts-ignore FIXME #AFL required only for Codesandbox (which uses an old rendering engine), since Ivy (Angular >9) 'entryComponents' is no longer required in standalone apps
  entryComponents: [ThemeSettingsPanelComponent],
})
export class AppModule {}
```

<!-- /framework -->

<!-- framework: react -->
### React

Provide bespoke content with `frameworkComponent` — a function that receives `{ adaptableApi }` and returns JSX.

See [Building Custom Components](https://www.adaptabletools.com/docs/ui-tutorial-building-custom-components/index.md) for `ReactFrameworkComponent` patterns

### Providing a Custom Settings Panel (React)

Standard React component; subscribe to AdapTable events as needed.

```tsx
export const ThemeSettingsPanel = ({
  adaptableApi,
}: {
  adaptableApi: AdaptableApi;
}) => {
  const [currentTheme, setCurrentTheme] = useState(
    adaptableApi.themeApi.getCurrentTheme()
  );

  useEffect(() => {
    adaptableApi.eventApi.on('ThemeSelected', () => {
      setCurrentTheme(adaptableApi.themeApi.getCurrentTheme());
    });
  }, []);

  return (
    <>
      <h3>Theme Switcher</h3>
      <p>Current Theme is {currentTheme}</p>
      <div className="themeToggle">
        <span>Switch to </span>
        <SlideToggle
          onText="Light"
          offText="Dark"
          onToggleChange={toggleValue => {
            toggleValue
              ? adaptableApi.themeApi.loadDarkTheme()
              : adaptableApi.themeApi.loadLightTheme();
          }}
        />
      </div>
    </>
  );
};
```

Add `frameworkComponent` in `customSettingsPanels`, set an optional `description`, and include the panel `name` in `navigation` groups.

```ts [[1, 2, "customSettingsPanels"], [1, 5, "description"], [1, 7, "frameworkComponent"], [2, 12, "navigation:"]]
settingsPanelOptions: {
  customSettingsPanels: [
    {
      name: 'Theme Switcher',
      description: 'The custom theme',
      icon: {name: 'theme'},
      frameworkComponent: ({adaptableApi}) => (
        <ThemeSettingsPanel adaptableApi={adaptableApi} />
      ),
    },
  ],
  navigation: (_context, _defaultNavigation) => ({
    groups: [
      {label: 'Settings', items: ['Theme Switcher']},
      {label: 'Work', items: ['CalculatedColumn', 'FormatColumn']},
      {label: 'Admin', items: ['Theme']},
    ],
  }),
},
```

**Example: Custom Settings Panel (React)**

React component as a Custom Settings Panel

- **Theme Switcher** is the custom theme, with a live theme label and toggle
- `description` shows under the panel name in the navigation
- Custom navigation places the panel at the top of the list

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

```text
src/
  agGridModules.ts        [template]
  App.tsx
  columnDefs.ts           [template]
  gridOptions.ts          [template]
  index.tsx               [template]
  onAdaptableReady.ts
  rowData.ts              [template]
  SlideToggle.tsx
  styles.css              [template + shown below]
  ThemeSettingsPanel.tsx
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#react).

**`src/App.tsx`**

```ts
import * as React from 'react';
import {useState} from 'react';
import {
  Adaptable,
  AdaptableApi,
  AdaptableOptions,
  AdaptableReadyInfo,
} from '@adaptabletools/adaptable-react-aggrid';

import {GridOptions} from 'ag-grid-enterprise';

// import adaptable css
import '@adaptabletools/adaptable-react-aggrid/index.css';
// import aggrid themes (using Balham theme)

import './styles.css';

import {onAdaptableReady} from './onAdaptableReady';
import {gridOptions} from './gridOptions';
import {agGridModules} from './agGridModules';
import {ThemeSettingsPanel} from './ThemeSettingsPanel';
import {WebFramework} from './rowData';

const App: React.FunctionComponent = () => {
  const adaptableApiRef = React.useRef<AdaptableApi>(null);

  const [adaptOptions, setAdaptOptions] = useState<
    AdaptableOptions<WebFramework>
  >({
    primaryKey: 'id',
    adaptableId: 'Custom Settings Panel Demo',
    settingsPanelOptions: {
      customSettingsPanels: [
        {
          name: 'Theme Switcher',
          description: 'The custom theme',
          frameworkComponent: ({adaptableApi}) => {
            return <ThemeSettingsPanel adaptableApi={adaptableApi} />;
          },
          icon: {
            name: 'theme',
          },
        },
      ],
      navigation: (_context, _defaultNavigation) => ({
        groups: [
          {label: 'Settings', items: ['Theme Switcher']},
          {label: 'Work', items: ['CalculatedColumn', 'FormatColumn']},
          {label: 'UI', items: ['Dashboard', 'ToolPanel']},
          {label: 'Administration', items: ['Alert', 'CustomSort', 'Export']},
          {label: 'Support', items: ['GridInfo', 'TeamSharing', 'Theme']},
        ],
      }),
    },
    initialState: {
      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,
          },
        ],
      },
    },
  });
  const [agGridOptions, setAgGridOptions] = useState<GridOptions>(gridOptions);

  return (
    <div style={{display: 'flex', flexFlow: 'column', height: '100vh'}}>
      <div id="demoOutputAbove"></div>
      <Adaptable.Provider
        gridOptions={agGridOptions}
        adaptableOptions={adaptOptions}
        modules={[...agGridModules]}
        onAdaptableReady={(adaptableReadyInfo: AdaptableReadyInfo) => {
          // save a reference to adaptable api
          adaptableApiRef.current = adaptableReadyInfo.adaptableApi;
          onAdaptableReady(adaptableReadyInfo);
        }}>
        <Adaptable.UI style={{flex: 'none'}} />
        <Adaptable.AgGridReact />
      </Adaptable.Provider>
      <div id="demoOutputBelow"></div>
    </div>
  );
};
export default App;
```

**`src/SlideToggle.tsx`**

```ts
import * as React from 'react';
import {useState} from 'react';

export interface SlideToggleProps {
  defaultValue?: boolean;
  onText?: string;
  onColor?: string;
  offText?: string;
  offColor?: string;
  onToggleChange(toggleValue: boolean): void;
}
export const SlideToggle = (props: SlideToggleProps) => {
  const {
    defaultValue = false,
    onText = 'ON',
    onColor = 'var(--ab-color-success)',
    offText = 'OFF',
    offColor = 'var(--ab-color-info)',
    onToggleChange,
  } = props;

  const [toggleValue, setToggleValue] = useState(defaultValue);

  return (
    <>
      <label className="switch">
        <input
          className="switch-input"
          type="checkbox"
          checked={toggleValue}
          onChange={() => {
            const newValue = !toggleValue;
            setToggleValue(newValue);
            onToggleChange(newValue);
          }}
        />
        <span
          className="switch-label"
          data-on={onText}
          data-off={offText}
          style={{background: toggleValue ? onColor : offColor}}></span>
        <span className="switch-handle"></span>
      </label>
    </>
  );
};
```

**`src/ThemeSettingsPanel.tsx`**

```ts
import * as React from 'react';
import {useEffect, useState} from 'react';
import {AdaptableApi} from '@adaptabletools/adaptable-react-aggrid';
import {SlideToggle} from './SlideToggle';

export const ThemeSettingsPanel = ({
  adaptableApi,
}: {
  adaptableApi: AdaptableApi;
}) => {
  const [currentTheme, setCurrentTheme] = useState(
    adaptableApi.themeApi.getCurrentTheme()
  );

  useEffect(() => {
    adaptableApi.eventApi.on('ThemeSelected', () => {
      setCurrentTheme(adaptableApi.themeApi.getCurrentTheme());
    });
  }, []);

  return (
    <>
      <h3>Theme Switcher</h3>
      <p>Current Theme is {currentTheme}</p>
      <div className="themeToggle">
        <span>Switch to </span>
        <SlideToggle
          onText={'Light'}
          offText={'Dark'}
          onColor={'#c0ce28'}
          offColor={'#01222c'}
          onToggleChange={(toggleValue: boolean) => {
            if (toggleValue) {
              adaptableApi.themeApi.loadDarkTheme();
            } else {
              adaptableApi.themeApi.loadLightTheme();
            }
          }}
        />
      </div>
    </>
  );
};
```

**`src/onAdaptableReady.ts`**

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

export const onAdaptableReady = ({adaptableApi}: AdaptableReadyInfo) => {
  adaptableApi.settingsPanelApi.openCustomSettingsPanel(
    'Theme Switcher'
  );
};
```

**`src/styles.css`**

```css
/*
  toggle-switch
*/
.switch {
  position: relative;
  display: block;
  width: 100px;
  height: 30px;
  padding: 3px;
  margin: 2px;
  background: -webkit-linear-gradient(top, #eeeeee, #ffffff 25px);
  border-radius: 18px;
  box-shadow: inset 0 -1px white, inset 0 1px 1px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  box-sizing: content-box;
}
.switch-input {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  box-sizing: content-box;
}
.switch-input:checked ~ .switch-label {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15),
    inset 0 0 3px rgba(0, 0, 0, 0.2);
}
.switch-input:checked ~ .switch-label:before {
  opacity: 0;
}
.switch-input:checked ~ .switch-label:after {
  opacity: 1;
}
.switch-input:checked ~ .switch-handle {
  left: 74px;
  box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2);
}
.switch-label {
  position: relative;
  display: block;
  height: inherit;
  background: #eceeef;
  font-size: 10px;
  text-transform: uppercase;
  border-radius: inherit;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12),
    inset 0 0 2px rgba(0, 0, 0, 0.15);
  box-sizing: content-box;
  transition: All 0.3s ease;
  -webkit-transition: All 0.3s ease;
  -moz-transition: All 0.3s ease;
  -o-transition: All 0.3s ease;
}
.switch-label:before {
  position: absolute;
  top: 50%;
  margin-top: -0.5em;
  line-height: 1;
  -webkit-transition: inherit;
  -moz-transition: inherit;
  -o-transition: inherit;
  transition: inherit;
  box-sizing: content-box;
  content: attr(data-off);
  right: 11px;
  color: #ffffff;
  text-shadow: 0 1px rgba(0, 0, 0, 0.2);
}
.switch-label:after {
  position: absolute;
  top: 50%;
  margin-top: -0.5em;
  line-height: 1;
  -webkit-transition: inherit;
  -moz-transition: inherit;
  -o-transition: inherit;
  transition: inherit;
  box-sizing: content-box;
  content: attr(data-on);
  left: 11px;
  color: #ffffff;
  text-shadow: 0 1px rgba(0, 0, 0, 0.2);
  opacity: 0;
}
.switch-handle {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  background: -webkit-linear-gradient(top, #ffffff 40%, #f0f0f0);
  border-radius: 100%;
  box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
  transition: All 0.3s ease;
  -webkit-transition: All 0.3s ease;
  -moz-transition: All 0.3s ease;
  -o-transition: All 0.3s ease;
}
.switch-handle:before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -6px 0 0 -6px;
  width: 12px;
  height: 12px;
  background: -webkit-linear-gradient(top, #eeeeee, #ffffff);
  border-radius: 6px;
  box-shadow: inset 0 1px rgba(0, 0, 0, 0.02);
}

/*
 Custom theme panel
*/
.themeToggle {
  display: flex;
  gap: calc(var(--ab-base-space) * 2);
  align-items: center;
}
```



<!-- /framework -->

<!-- framework: vue -->
### Vue

Provide bespoke content with `frameworkComponent` — typically a factory that returns `h(YourComponent, { adaptableApi })`.

See [Building Custom Components](https://www.adaptabletools.com/docs/ui-tutorial-building-custom-components/index.md) for `VueFrameworkComponent` patterns

### Providing a Custom Settings Panel (Vue)

Receive `adaptableApi` as a prop from `frameworkComponent`.

```vue
<script setup>
import {ref, onMounted} from 'vue';
import SlideToggle from './SlideToggle.vue';

const props = defineProps({
  adaptableApi: {type: Object, required: true},
});

const currentTheme = ref(props.adaptableApi.themeApi.getCurrentTheme());

onMounted(() => {
  props.adaptableApi.eventApi.on('ThemeSelected', () => {
    currentTheme.value = props.adaptableApi.themeApi.getCurrentTheme();
  });
});
</script>

<template>
  <div>
    <h3>Theme Switcher</h3>
    <p>Current Theme is {{ currentTheme }}</p>
    <SlideToggle
      :onText="'Light'"
      :offText="'Dark'"
      @toggleChange="
        toggleValue => {
          toggleValue
            ? props.adaptableApi.themeApi.loadDarkTheme()
            : props.adaptableApi.themeApi.loadLightTheme();
        }
      " />
  </div>
</template>
```

Register with `h()` in `frameworkComponent`, set an optional `description`, and return grouped entries from the `navigation` configurer.

```ts [[1, 2, "customSettingsPanels"], [1, 5, "description"], [1, 7, "frameworkComponent"], [2, 11, "navigation:"]]
settingsPanelOptions: {
  customSettingsPanels: [
    {
      name: 'Theme Switcher',
      description: 'The custom theme',
      icon: {name: 'theme'},
      frameworkComponent: ({adaptableApi}) =>
        h(ThemeSettingsPanel, {adaptableApi}),
    },
  ],
  navigation: (_context, _defaultNavigation) => ({
    groups: [
      {label: 'Settings', items: ['Theme Switcher']},
      {label: 'Work', items: ['CalculatedColumn', 'FormatColumn']},
      {label: 'Admin', items: ['Theme']},
    ],
  }),
},
```

**Example: Custom Settings Panel (Vue)**

Vue component as a Custom Settings Panel

- **Theme Switcher** is the custom theme, using `h(ThemeSettingsPanel, …)` in `frameworkComponent`
- `description` shows under the panel name in the navigation
- Navigation lists the custom panel first

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

```text
public/
  index.html              [template]
src/
  agGridModules.ts        [template]
  App.vue
  columnDefs.ts           [template]
  gridOptions.ts          [template]
  main.ts                 [template]
  onAdaptableReady.ts
  rowData.ts              [template]
  shims-vue.d.ts          [template]
  SlideToggle.vue
  styles.css              [template]
  ThemeSettingsPanel.vue
.babelrc                  [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#vue).

**`src/App.vue`**

```ts
<script setup lang="ts">
import {h} from 'vue';
import {
  AdaptableProvider,
  AdaptableAgGridVue,
  AdaptableUI,
  AdaptableOptions,
} from '@adaptabletools/adaptable-vue3-aggrid';

import {onAdaptableReady} from './onAdaptableReady';
import {gridOptions} from './gridOptions';
import {agGridModules} from './agGridModules';
import {WebFramework} from './rowData';
import ThemeSettingsPanel from './ThemeSettingsPanel.vue';

const adaptableOpts: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Custom Settings Panel Demo',
  stateOptions: {loadState: () => Promise.resolve({})},
  settingsPanelOptions: {
    customSettingsPanels: [
      {
        name: 'Theme Switcher',
        description: 'The custom theme',
        frameworkComponent: ({adaptableApi}) =>
          h(ThemeSettingsPanel, {adaptableApi}),
        icon: {
          name: 'theme',
        },
      },
    ],
    navigation: (_context, _defaultNavigation) => ({
      groups: [
        {label: 'Settings', items: ['Theme Switcher']},
        {label: 'Work', items: ['CalculatedColumn', 'FormatColumn']},
        {label: 'UI', items: ['Dashboard', 'ToolPanel']},
        {label: 'Administration', items: ['Alert', 'CustomSort', 'Export']},
        {label: 'Support', items: ['GridInfo', 'TeamSharing', 'Theme']},
      ],
    }),
  },
};
</script>

<template>
  <AdaptableProvider
    :gridOptions="gridOptions"
    :adaptableOptions="adaptableOpts"
    :modules="agGridModules"
    @onAdaptableReady="onAdaptableReady">
    <div style="display: flex; flex-direction: column; height: 100vh">
      <AdaptableUI />
      <AdaptableAgGridVue style="flex: 1" />
    </div>
  </AdaptableProvider>
</template>
```

**`src/SlideToggle.vue`**

```ts
<script setup lang="ts">
import {ref} from 'vue';

const props = defineProps({
  defaultValue: {
    type: Boolean,
    default: false,
  },
  onText: {
    type: String,
    default: 'ON',
  },
  onColor: {
    type: String,
    default: 'var(--ab-color-success)',
  },
  offText: {
    type: String,
    default: 'OFF',
  },
  offColor: {
    type: String,
    default: 'var(--ab-color-info)',
  },
});

const emit = defineEmits<{
  (e: 'toggleChange', value: boolean): boolean;
}>();

const toggleValue = ref(props.defaultValue);

function handleChange() {
  toggleValue.value = !toggleValue.value;
  emit('toggleChange', toggleValue.value);
}
</script>

<template>
  <label class="switch">
    <input
      class="switch-input"
      type="checkbox"
      :checked="toggleValue"
      @change="handleChange" />
    <span
      class="switch-label"
      :data-on="props.onText"
      :data-off="props.offText"
      :style="{
        background: toggleValue ? props.onColor : props.offColor,
      }"></span>
    <span class="switch-handle"></span>
  </label>
</template>

<style scoped>
.switch {
  position: relative;
  display: block;
  width: 100px;
  height: 30px;
  padding: 3px;
  margin: 2px;
  background: linear-gradient(to bottom, #eeeeee, #ffffff 25px);
  border-radius: 18px;
  box-shadow:
    inset 0 -1px white,
    inset 0 1px 1px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  box-sizing: content-box;
}
.switch-input {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  box-sizing: content-box;
}
.switch-input:checked ~ .switch-label {
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.15),
    inset 0 0 3px rgba(0, 0, 0, 0.2);
}
.switch-input:checked ~ .switch-label:before {
  opacity: 0;
}
.switch-input:checked ~ .switch-label:after {
  opacity: 1;
}
.switch-input:checked ~ .switch-handle {
  left: 74px;
  box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2);
}
.switch-label {
  position: relative;
  display: block;
  height: inherit;
  background: #eceeef;
  font-size: 10px;
  text-transform: uppercase;
  border-radius: inherit;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.12),
    inset 0 0 2px rgba(0, 0, 0, 0.15);
  box-sizing: content-box;
  transition: All 0.3s ease;
  -webkit-transition: All 0.3s ease;
  -moz-transition: All 0.3s ease;
  -o-transition: All 0.3s ease;
}
.switch-label:before {
  position: absolute;
  top: 50%;
  margin-top: -0.5em;
  line-height: 1;
  -webkit-transition: inherit;
  -moz-transition: inherit;
  -o-transition: inherit;
  transition: inherit;
  box-sizing: content-box;
  content: attr(data-off);
  right: 11px;
  color: #ffffff;
  text-shadow: 0 1px rgba(0, 0, 0, 0.2);
}
.switch-label:after {
  position: absolute;
  top: 50%;
  margin-top: -0.5em;
  line-height: 1;
  -webkit-transition: inherit;
  -moz-transition: inherit;
  -o-transition: inherit;
  transition: inherit;
  box-sizing: content-box;
  content: attr(data-on);
  left: 11px;
  color: #ffffff;
  text-shadow: 0 1px rgba(0, 0, 0, 0.2);
  opacity: 0;
}
.switch-handle {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  background: linear-gradient(to bottom, #ffffff 40%, #f0f0f0);
  border-radius: 100%;
  box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
  transition: All 0.3s ease;
  -webkit-transition: All 0.3s ease;
  -moz-transition: All 0.3s ease;
  -o-transition: All 0.3s ease;
}
.switch-handle:before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -6px 0 0 -6px;
  width: 12px;
  height: 12px;
  background: linear-gradient(to bottom, #eeeeee, #ffffff);
  border-radius: 6px;
  box-shadow: inset 0 1px rgba(0, 0, 0, 0.02);
}
</style>
```

**`src/ThemeSettingsPanel.vue`**

```ts
<script setup>
import {ref, onMounted} from 'vue';
import SlideToggle from './SlideToggle.vue';

const props = defineProps({
  adaptableApi: {
    type: Object,
    required: true,
  },
});

const currentTheme = ref(props.adaptableApi.themeApi.getCurrentTheme());

onMounted(() => {
  props.adaptableApi.eventApi.on('ThemeSelected', () => {
    currentTheme.value = props.adaptableApi.themeApi.getCurrentTheme();
  });
});

const handleToggleChange = toggleValue => {
  if (toggleValue) {
    props.adaptableApi.themeApi.loadDarkTheme();
  } else {
    props.adaptableApi.themeApi.loadLightTheme();
  }
};
</script>

<template>
  <div>
    <h3>Theme Switcher</h3>
    <p>Current Theme is {{ currentTheme }}</p>
    <div class="themeToggle">
      <span>Switch to </span>
      <SlideToggle
        :onText="'Light'"
        :offText="'Dark'"
        :onColor="'#c0ce28'"
        :offColor="'#01222c'"
        @toggleChange="handleToggleChange" />
    </div>
  </div>
</template>

<style scoped>
.themeToggle {
  display: flex;
  gap: calc(var(--ab-base-space) * 2);
  align-items: center;
}
</style>
```

**`src/onAdaptableReady.ts`**

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

export const onAdaptableReady = ({adaptableApi}: AdaptableReadyInfo) => {
  adaptableApi.settingsPanelApi.openCustomSettingsPanel(
    'Theme Switcher'
  );
};
```



<!-- /framework -->

### Setting Navigation order

Use the `navigation` configurer on [Settings Panel Options](https://www.adaptabletools.com/docs/technical-reference-settings-panel/index.md) to customise grouped navigation in the Settings Panel.

The function receives AdapTable context and a clone of the default navigation, and returns `{ groups: [...] }` where each group has:

- `label` — section heading (use an empty string for items without a heading)
- `items` — module or custom panel names in display order

[Configuring the Settings Panel](https://www.adaptabletools.com/docs/ui-settings-panel-configuring/index.md) explains how to list shipped modules, custom panels, and groupings.

- Custom panels will not appear unless **explicitly listed** in your navigation groups
- If you **omit** `navigation`, AdapTable uses the default grouped module list and **appends** each custom panel to a `Custom Panels` group at the end
