# Adaptable Icon

Canonical page: https://www.adaptabletools.com/docs/ui-tutorial-creating-icon

- The Adaptable Icon object enables the provision of customizable icons
- Icons are very widely used in Adaptable including in Buttons, Menus, and Badge Style
- An AdapTable Icon can be one of 3 types:
  - a **System** icon provided by AdapTable
  - a **Custom** icon provided by a developer
  - an **HTML element** provided by a developer

## Topics on this Page

| Topic                                        | Summary                     |
| -------------------------------------------- | --------------------------- |
| [Icon types](#types-of-adaptable-icon)       | System, custom, HTML        |
| [Application icon](#application-icon)        | Dashboard, Settings, toasts |
| [Appendix](#appendix-adaptable-icon-library) | System icon names           |

[UI Guides](https://www.adaptabletools.com/docs/ui-tutorial-overview/index.md).

The Adaptable Icon is used in many places in AdapTable including:

- In [Adaptable Buttons](https://www.adaptabletools.com/docs/ui-tutorial-displaying-adaptable-buttons/index.md)
- As the [Application Icon](#application-icon) (which appears in the [Dashboard](https://www.adaptabletools.com/docs/ui-dashboard/index.md) and [Toast Notifications](https://www.adaptabletools.com/docs/ui-tutorial-using-toast-notifications/index.md))
- In [Column Menu](https://www.adaptabletools.com/docs/ui-column-menu/index.md) and [Context Menu](https://www.adaptabletools.com/docs/ui-context-menu/index.md) items
- In [Badge Style](https://www.adaptabletools.com/docs/handbook-styled-column-badge/index.md) Columns

AdapTable Icons can be styled as needed.

## Types of Adaptable Icon

An Adaptable Icon definition (of type [`AdaptableIcon`](https://www.adaptabletools.com/docs/reference/adaptableicon.md)) can be one of 3 types:

- [System Icon](#system-icon) - shipped with AdapTable
- [Custom Icon](#custom-icon) - defined and provided by the user
- [HTML Element Icon](#html-element-icon) - specified by the user

### System Icon

AdapTable provides a number of SVG icons that can be used in various use cases.

This is done by simply referencing the `name` of the icon.

The full list of available AdapTable Icons - with their names - is provided in the Appendix to this page

Optionally the `size` of the icon may be specified.

### The System Icon Definition

The [`System Icon`](https://www.adaptabletools.com/docs/reference/adaptablesystemicon.md) object defined as follows:

| Property | Type | Description |
| --- | --- | --- |
| [name](https://www.adaptabletools.com/docs/reference/adaptablesystemicon.md#name) | `TypeHint<string, `[`AdaptableSystemIconName`](https://www.adaptabletools.com/docs/reference/adaptablesystemiconname.md)`>` | The name of the icon to use (referencing the AdapTable Icon Library)<br/><br/>The icon can be an AdapTable icon or a custom one defined in `userInterfaceOptions.customIcons` |
| [size](https://www.adaptabletools.com/docs/reference/adaptablesystemicon.md#size) | `number` | The size (in pixels) of the SVG icon (defaults to `17px`) |

It derives from [`Base Icon`](https://www.adaptabletools.com/docs/reference/adaptablebaseicon.md) which includes these properties:

| Property | Type | Description |
| --- | --- | --- |
| [className](https://www.adaptabletools.com/docs/reference/adaptablebaseicon.md#classname) | `string` | The class name of the icon |
| [style](https://www.adaptabletools.com/docs/reference/adaptablebaseicon.md#style) | `React.CSSProperties` | CSS Properties |

**Example: System Adaptable Icons**

Leveraging System Icons in AdapTable

- This demo leverages a number of different **System Icons** which are used in various ways:
  - an Application Icon (see below for more details) that uses the `home` System Icon
  - 2 [Custom Filters](https://www.adaptabletools.com/docs/handbook-column-filter-custom-filters/index.md) (`Popular` & `Vanilla` on the `Name` & `Language` columns) - boolean Expression Functions whose operators use the `broadcast` and `check-circle` System Icons
  - 3 [Custom Toolbar Buttons](https://www.adaptabletools.com/docs/ui-dashboard-custom-toolbars/index.md) which apply the 2 Custom Filters described above (and the same System Icons) plus a Clear button (that uses `close` System Icon)
  - a [Dashboard Button](https://www.adaptabletools.com/docs/ui-dashboard-buttons/index.md) to switch Themes that uses the `theme` system icon
  - a [Badge Style](https://www.adaptabletools.com/docs/handbook-styled-column-badge/index.md#icon-only-badges) on the `Language` column that uses the `assignment` System Icon
  - a [User Context Menu Item](https://www.adaptabletools.com/docs/ui-context-menu/index.md) (`Expand / Collapse Dashboard`) that uses `expand` and `collapse` System Icons
  - a [User Column Menu Item](https://www.adaptabletools.com/docs/ui-column-menu/index.md) to set System Status that uses `traffic-lights`,`error`, `warning`, `checked` and `info` System Icons

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 {
  AdaptableApi,
  AdaptableButton,
  AdaptableOptions,
  ColumnMenuContext,
  CustomColumnMenuContext,
  CustomContextMenuContext,
  CustomToolbarButtonContext,
  DashboardButtonContext,
  ExpressionContext,
  GlobalExpressionFunctionAvailabilityContext,
  UserColumnMenuItem,
  UserContextMenuItem,
} from '@adaptabletools/adaptable';

import {WebFramework} from './rowData';

// Applies a Column Filter for a single Column, leaving any other Column
// Filters in place (the successor to the removed setColumnFilterForColumn).
const applyColumnFilter = (
  api: AdaptableApi,
  columnId: string,
  expression: string
) => {
  const others = api.filterApi.columnFilterApi
    .getColumnFilters()
    .filter((filter) => filter.ColumnId !== columnId);
  api.filterApi.columnFilterApi.setColumnFilters([
    ...others,
    {ColumnId: columnId, Expression: expression},
  ]);
};

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Adaptable System Icons',
  expressionOptions: {
    customStandardFunctions: {
      // A no-input boolean operator (labelled "Popular", icon "broadcast").
      // It reads other columns from the row rather than its own value.
      IS_POPULAR: {
        handler: (_args: any[], context: ExpressionContext) => {
          const row = context.getRowData() as WebFramework;
          return row.github_stars > 50000 && row.github_watchers > 500;
        },
        returnType: 'boolean',
        operands: [['text']],
        label: 'Popular',
        icon: {name: 'broadcast'},
        description: 'Highly starred and watched frameworks',
      },
      // A no-input boolean operator (labelled "Vanilla", icon "check-circle").
      IS_VANILLA: {
        handler: (args: any[]) =>
          args[0] === 'JavaScript' || args[0] === 'HTML',
        returnType: 'boolean',
        operands: [['text']],
        label: 'Vanilla',
        icon: {name: 'check-circle'},
        description: 'Language is JavaScript or HTML',
      },
    },
    isExpressionFunctionAvailable: (
      context: GlobalExpressionFunctionAvailabilityContext
    ) => {
      if (context.module === 'ColumnFilter' && context.column) {
        if (context.functionName === 'IS_POPULAR') {
          return context.column.columnId === 'name';
        }
        if (context.functionName === 'IS_VANILLA') {
          return context.column.columnId === 'language';
        }
      }
      return context.defaultAvailability;
    },
  },
  contextMenuOptions: {
    customContextMenu: (context: CustomContextMenuContext) => {
      const {
        defaultAgGridMenuStructure,
        defaultAdaptableMenuStructure,
        adaptableApi,
      } = context;

      const customDashboardMenuItem: UserContextMenuItem = {
        menuType: 'User',
        label: adaptableApi.dashboardApi.isDashboardCollapsed()
          ? 'Expand Dashboard'
          : 'Collapse Dashboard',
        onClick: () =>
          adaptableApi.dashboardApi.isDashboardCollapsed()
            ? adaptableApi.dashboardApi.expandDashboard()
            : adaptableApi.dashboardApi.collapseDashboard(),
        icon: {
          name: adaptableApi.dashboardApi.isDashboardCollapsed()
            ? 'expand'
            : 'collapse',
        },
      };

      return [
        customDashboardMenuItem,
        '-',
        ...defaultAgGridMenuStructure,
        '-',
        ...defaultAdaptableMenuStructure,
      ];
    },
  },
  columnMenuOptions: {
    customColumnMenu: (context: CustomColumnMenuContext) => {
      const {
        defaultAgGridMenuStructure,
        defaultAdaptableMenuStructure,
        isRowGroupColumn,
        adaptableApi,
      } = context;

      if (isRowGroupColumn) {
        return [
          ...defaultAgGridMenuStructure,
          '-',
          ...defaultAdaptableMenuStructure,
        ];
      }

      const setSystemStatusMenuItem: UserColumnMenuItem = {
        menuType: 'User',
        label: 'Set System Status',
        icon: {
          name: 'traffic-lights',
        },
        subMenuItems: [
          {
            menuType: 'User',
            label: 'Set Error',

            onClick: (menuContext: ColumnMenuContext) => {
              menuContext.adaptableApi.systemStatusApi.setErrorSystemStatus(
                'System Down'
              );
            },
            icon: {
              name: 'error',
            },
          },
          {
            menuType: 'User',
            label: 'Set Warning',
            icon: {
              name: 'warning',
            },
            onClick: (menuContext: ColumnMenuContext) => {
              menuContext.adaptableApi.systemStatusApi.setWarningSystemStatus(
                'System Slow'
              );
            },
          },
          {
            menuType: 'User',
            label: 'Set Success',
            icon: {
              name: 'checked',
            },
            onClick: (menuContext: ColumnMenuContext) => {
              menuContext.adaptableApi.systemStatusApi.setSuccessSystemStatus(
                'System Fine'
              );
            },
          },
          {
            menuType: 'User',
            label: 'Set Info',
            icon: {
              name: 'info',
            },
            onClick: (menuContext: ColumnMenuContext) => {
              menuContext.adaptableApi.systemStatusApi.setInfoSystemStatus(
                'Demos working fine'
              );
            },
          },
        ],
      };

      return [
        setSystemStatusMenuItem,
        '-',
        ...defaultAgGridMenuStructure,
        '-',
        ...defaultAdaptableMenuStructure,
      ];
    },
  },
  dashboardOptions: {
    customToolbars: [
      {
        name: 'CustomToolbarButtons',
        title: 'Custom Filters',
        toolbarButtons: [
          {
            label: 'Popular',
            buttonStyle: {
              tone: 'neutral',
              variant: 'outlined',
            },
            icon: {
              name: 'broadcast',
              size: 100,
            },
            onClick: (
              _button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              applyColumnFilter(
                context.adaptableApi,
                'name',
                'IS_POPULAR([name])'
              );
            },
          },
          {
            label: 'Vanilla',
            buttonStyle: {
              tone: 'neutral',
              variant: 'outlined',
            },
            icon: {
              name: 'check-circle',
            },
            onClick: (
              _button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              applyColumnFilter(
                context.adaptableApi,
                'language',
                'IS_VANILLA([language])'
              );
            },
          },
          {
            label: 'Clear',
            buttonStyle: {
              tone: 'neutral',
              variant: 'outlined',
            },
            icon: {
              name: 'close',
            },
            onClick: (
              _button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              context.adaptableApi.filterApi.columnFilterApi.clearColumnFilters();
            },
          },
        ],
      },
    ],
    customDashboardButtons: [
      {
        label: 'Switch Theme',
        buttonStyle: {
          tone: 'neutral',
          variant: 'raised',
        },
        icon: {
          name: 'theme',
          size: 50,
        },
        onClick: (
          _button: AdaptableButton<DashboardButtonContext>,
          context: DashboardButtonContext
        ) => {
          const currentTheme = context.adaptableApi.themeApi.getCurrentTheme();
          if (currentTheme == 'light') {
            context.adaptableApi.themeApi.loadDarkTheme();
          } else {
            context.adaptableApi.themeApi.loadLightTheme();
          }
        },
      },
    ],
  },
  userInterfaceOptions: {
    applicationIcon: {
      name: 'home',
      size: 25,
    },
  },
  initialState: {
    Dashboard: {
      Tabs: [
        {
          Name: 'Default',
          Toolbars: ['CustomToolbarButtons', 'SystemStatus'],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    StyledColumn: {
      StyledColumns: [
        {
          ColumnId: 'language',
          Name: 'language Badge',
          BadgeStyle: {
            Badges: [
              {
                PillStyle: {
                  BackColor: 'var(--ab-color-palette-16)',
                  ForeColor: 'var(--ab-color-palette-14)',
                },
                IconProperties: {
                  Icon: {
                    name: 'assignment',
                  },
                },
              },
            ],
          },
        },
      ],
    },
    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,
        },
      ],
    },
  },
};
```

### Custom Icon

Where the System Icons are insufficient, Custom Icons may be provided by developers.

Technically, the icon will be rendered as an [`<img>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) element with the provided `src` attribute.

The `src` attribute of the `<img>` element may be a relative, or absolute, path to any [supported image format](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#supported_image_formats).

Alternatively, the image can be an SVG format if required.

Custom Icons can be configured in 2 ways:

- "in-place", directly provided when needed (e.g. when defining a Button)
- via the `customIcons` property in [User Interface Options](https://www.adaptabletools.com/docs/technical-reference-ui/index.md) and then referenced by name when needed

- An advantage of providing a `customIcons` collection is that you can easily re-use the same Icon in multiple places
- Another advantage is that run-time users can select these Icons in the UI (e.g. when creating a Badge Style)

### `customIcons`

Bespoke Icons that can be used in AdapTable (e.g. in Badge Styles and Buttons)

  [`CustomIcon[]`](https://www.adaptabletools.com/docs/reference/customicon.md)

Custom Icons can be provided to supplement the many system icons shipped by AdapTable.

These can then be used wherever icons are used e.g. in AdapTable Buttons or Badge Styles.

This property can be provided in 2 ways:

- as a hard-coded list
- as a function (useful if you are retrieving the icons from a server)

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

| Property | Type | Description |
| --- | --- | --- |
| [src](https://www.adaptabletools.com/docs/reference/adaptablecustomicon.md#src) | `string` | The URL of the icon to use |

It derives from [`Base Icon`](https://www.adaptabletools.com/docs/reference/adaptablebaseicon.md) which includes these properties:

| Property | Type | Description |
| --- | --- | --- |
| [className](https://www.adaptabletools.com/docs/reference/adaptablebaseicon.md#classname) | `string` | The class name of the icon |
| [style](https://www.adaptabletools.com/docs/reference/adaptablebaseicon.md#style) | `React.CSSProperties` | CSS Properties |

```tsx {2}
adaptableOptions.userInterfaceOptions = {
  customIcons: [
    {
      name: 'UK',
      icon: {
        src: 'https://upload.wikimedia.org/wikipedia/commons/1/13/United-kingdom_flag_icon_round.svg',
      },
    },
    {
      name: 'Germany',
      icon: {
        src: 'https://upload.wikimedia.org/wikipedia/en/thumb/b/ba/Flag_of_Germany.svg/800px-Flag_of_Germany.svg.png',
      },
    },
    {
      name: 'US',
      icon: {
        src: 'https://upload.wikimedia.org/wikipedia/commons/8/88/United-states_flag_icon_round.svg',
      },
    },
 ],
},
```

**Example: Custom Adaptable Icons**

How to use Custom Icons in Adaptable Buttons

- This demo defines 4 **Custom Icons** - `JavaScript`, `TypeScript`, `HTML` and `Popular` - in [User Interface Options](https://www.adaptabletools.com/docs/technical-reference-ui/index.md), which we use in multiple places:
  - as a [Badge Style](https://www.adaptabletools.com/docs/handbook-styled-column-badge/index.md) on the `Language` and `Name` columns
  - as [Custom Filters](https://www.adaptabletools.com/docs/handbook-column-filter-custom-filters/index.md) - boolean Expression Functions available as operators in the `Language` and `Name` columns
  - in a [User Context Menu Item](https://www.adaptabletools.com/docs/ui-context-menu/index.md) and [User Column Menu Item](https://www.adaptabletools.com/docs/ui-column-menu/index.md) (for the `Name` Column only) which use the `Popular` icon
  - as [Dashboard Buttons](https://www.adaptabletools.com/docs/ui-dashboard-buttons/index.md) and [Custom Toolbar Buttons](https://www.adaptabletools.com/docs/ui-dashboard-custom-toolbars/index.md)

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 {
  AdaptableApi,
  AdaptableButton,
  AdaptableOptions,
  CustomColumnMenuContext,
  CustomContextMenuContext,
  CustomToolbarButtonContext,
  DashboardButtonContext,
  GlobalExpressionFunctionAvailabilityContext,
  UserColumnMenuItem,
  UserContextMenuItem,
} from '@adaptabletools/adaptable';

const popularIconBase64 =
  'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHdpZHRoPSIyNCIgZmlsbD0iY3VycmVudENvbG9yIj48cGF0aCBkPSJNOC41IDkgNy40IDYuNiA1IDUuNSA3LjQgNC40IDguNSAyIDkuNiA0LjQgMTIgNS41IDkuNiA2LjZaTTE1IDEyIDE0LjA1IDkuOTUgMTIgOSAxNC4wNSA4LjA1IDE1IDYgMTUuOTUgOC4wNSAxOCA5IDE1Ljk1IDkuOTVaTTQgMTQgMy4wNSAxMS45NSAxIDExIDMuMDUgMTAuMDUgNCA4IDQuOTUgMTAuMDUgNyAxMSA0Ljk1IDExLjk1Wk00LjUgMjAuNSAzIDE5IDEwLjUgMTEuNSAxNC41IDE1LjUgMjEuNiA3LjUyNSAyMyA4LjkyNSAxNC41IDE4LjUgMTAuNSAxNC41WiIvPjwvc3ZnPg==';
import {WebFramework} from './rowData';

// Applies a Column Filter for a single Column, leaving any other Column
// Filters in place (the successor to the removed setColumnFilterForColumn).
const applyColumnFilter = (
  api: AdaptableApi,
  columnId: string,
  expression: string
) => {
  const others = api.filterApi.columnFilterApi
    .getColumnFilters()
    .filter((filter) => filter.ColumnId !== columnId);
  api.filterApi.columnFilterApi.setColumnFilters([
    ...others,
    {ColumnId: columnId, Expression: expression},
  ]);
};

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Adaptable Custom Icons',
  expressionOptions: {
    // Each custom boolean function becomes a filter operator; the `icon`
    // references a Custom Icon defined in userInterfaceOptions.customIcons.
    customStandardFunctions: {
      IS_JAVASCRIPT: {
        handler: (args: any[]) => args[0] === 'JavaScript',
        returnType: 'boolean',
        operands: [['text']],
        label: 'JavaScript',
        icon: {name: 'javascript'},
      },
      IS_TYPESCRIPT: {
        handler: (args: any[]) => args[0] === 'TypeScript',
        returnType: 'boolean',
        operands: [['text']],
        label: 'TypeScript',
        icon: {name: 'typescript'},
      },
      IS_HTML: {
        handler: (args: any[]) => args[0] === 'HTML',
        returnType: 'boolean',
        operands: [['text']],
        label: 'HTML',
        icon: {name: 'html'},
      },
      IS_POPULAR: {
        handler: (args: any[]) =>
          ['react', 'angular', 'vue', 'stencil', 'solid'].includes(args[0]),
        returnType: 'boolean',
        operands: [['text']],
        label: 'Popular',
        icon: {name: 'popular'},
      },
    },
    isExpressionFunctionAvailable: (
      context: GlobalExpressionFunctionAvailabilityContext
    ) => {
      if (context.module === 'ColumnFilter' && context.column) {
        if (context.functionName === 'IS_POPULAR') {
          return context.column.columnId === 'name';
        }
        if (
          context.functionName === 'IS_JAVASCRIPT' ||
          context.functionName === 'IS_TYPESCRIPT' ||
          context.functionName === 'IS_HTML'
        ) {
          return context.column.columnId === 'language';
        }
      }
      return context.defaultAvailability;
    },
  },
  contextMenuOptions: {
    customContextMenu: (context: CustomContextMenuContext) => {
      const {defaultAgGridMenuStructure, defaultAdaptableMenuStructure} =
        context;

      const customFilterNameMenuItem: UserContextMenuItem = {
        menuType: 'User',
        label: 'Show Popular',
        onClick: () =>
          applyColumnFilter(context.adaptableApi, 'name', 'IS_POPULAR([name])'),
        hidden: context.adaptableColumn.columnId !== 'name',
        icon: {
          name: 'popular',
        },
      };

      return [
        customFilterNameMenuItem,
        '-',
        ...defaultAgGridMenuStructure,
        '-',
        ...defaultAdaptableMenuStructure,
      ];
    },
  },
  columnMenuOptions: {
    customColumnMenu: (context: CustomColumnMenuContext) => {
      const {
        defaultAgGridMenuStructure,
        defaultAdaptableMenuStructure,
        isRowGroupColumn,
      } = context;

      if (isRowGroupColumn) {
        return [
          ...defaultAgGridMenuStructure,
          '-',
          ...defaultAdaptableMenuStructure,
        ];
      }

      const customFilterNameMenuItem: UserColumnMenuItem = {
        menuType: 'User',
        label: 'Show Popular',
        onClick: () =>
          applyColumnFilter(context.adaptableApi, 'name', 'IS_POPULAR([name])'),
        hidden: context.adaptableColumn.columnId !== 'name',
        icon: {
          name: 'popular',
        },
      };

      return [
        customFilterNameMenuItem,
        '-',
        ...defaultAgGridMenuStructure,
        '-',
        ...defaultAdaptableMenuStructure,
      ];
    },
  },
  dashboardOptions: {
    customToolbars: [
      {
        name: 'CustomToolbarButtons',
        title: 'Custom Filters',
        toolbarButtons: [
          {
            label: 'Popular',
            buttonStyle: {
              tone: 'neutral',
              variant: 'outlined',
            },
            icon: {
              name: 'popular',
            },
            onClick: (
              _button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              applyColumnFilter(
                context.adaptableApi,
                'name',
                'IS_POPULAR([name])'
              );
            },
          },
          {
            label: 'JavaScript',
            buttonStyle: {
              tone: 'neutral',
              variant: 'outlined',
            },
            icon: {
              name: 'javascript',
            },
            onClick: (
              _button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              applyColumnFilter(
                context.adaptableApi,
                'language',
                'IS_JAVASCRIPT([language])'
              );
            },
          },
          {
            label: 'TypeScript',
            buttonStyle: {
              tone: 'neutral',
              variant: 'outlined',
            },
            icon: {
              name: 'typescript',
            },
            onClick: (
              _button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              applyColumnFilter(
                context.adaptableApi,
                'language',
                'IS_TYPESCRIPT([language])'
              );
            },
          },
          {
            label: 'HTML',
            buttonStyle: {
              tone: 'neutral',
              variant: 'outlined',
            },
            icon: {
              name: 'html',
            },
            onClick: (
              _button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              applyColumnFilter(
                context.adaptableApi,
                'language',
                'IS_HTML([language])'
              );
            },
          },
          {
            label: 'Clear',
            buttonStyle: {
              tone: 'neutral',
              variant: 'outlined',
            },
            icon: {
              name: 'close',
            },
            onClick: (
              _button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              context.adaptableApi.filterApi.columnFilterApi.clearColumnFilters();
            },
          },
        ],
      },
    ],
    customDashboardButtons: [
      {
        buttonStyle: {
          tone: 'neutral',
          variant: 'outlined',
        },
        icon: {
          src: popularIconBase64,
        },
        onClick: (
          _button: AdaptableButton<DashboardButtonContext>,
          context: DashboardButtonContext
        ) => {
          applyColumnFilter(context.adaptableApi, 'name', 'IS_POPULAR([name])');
        },
      },
      {
        buttonStyle: {
          tone: 'neutral',
          variant: 'outlined',
        },
        icon: {
          src: 'https://upload.wikimedia.org/wikipedia/commons/9/99/Unofficial_JavaScript_logo_2.svg',
        },
        onClick: (
          _button: AdaptableButton<DashboardButtonContext>,
          context: DashboardButtonContext
        ) => {
          applyColumnFilter(
            context.adaptableApi,
            'language',
            'IS_JAVASCRIPT([language])'
          );
        },
      },
      {
        buttonStyle: {
          tone: 'neutral',
          variant: 'outlined',
        },
        icon: {
          src: 'https://upload.wikimedia.org/wikipedia/commons/4/4c/Typescript_logo_2020.svg',
        },
        onClick: (
          _button: AdaptableButton<DashboardButtonContext>,
          context: DashboardButtonContext
        ) => {
          applyColumnFilter(
            context.adaptableApi,
            'language',
            'IS_TYPESCRIPT([language])'
          );
        },
      },
      {
        buttonStyle: {
          tone: 'neutral',
          variant: 'outlined',
        },
        icon: {
          src: 'https://upload.wikimedia.org/wikipedia/commons/6/61/HTML5_logo_and_wordmark.svg',
        },
        onClick: (
          _button: AdaptableButton<DashboardButtonContext>,
          context: DashboardButtonContext
        ) => {
          applyColumnFilter(context.adaptableApi, 'language', 'IS_HTML([language])');
        },
      },
      {
        buttonStyle: {
          tone: 'neutral',
          variant: 'outlined',
        },
        icon: {
          name: 'close',
        },
        onClick: (
          _button: AdaptableButton<DashboardButtonContext>,
          context: DashboardButtonContext
        ) => {
          context.adaptableApi.filterApi.columnFilterApi.clearColumnFilters();
        },
      },
    ],
  },
  userInterfaceOptions: {
    customIcons: [
      {
        name: 'javascript',
        icon: {
          src: 'https://upload.wikimedia.org/wikipedia/commons/9/99/Unofficial_JavaScript_logo_2.svg',
        },
      },
      {
        name: 'typescript',
        icon: {
          src: 'https://upload.wikimedia.org/wikipedia/commons/4/4c/Typescript_logo_2020.svg',
        },
      },
      {
        name: 'html',
        icon: {
          src: 'https://upload.wikimedia.org/wikipedia/commons/6/61/HTML5_logo_and_wordmark.svg',
        },
      },
      {
        name: 'popular',
        icon: {
          src: popularIconBase64,
        },
      },
    ],
  },
  initialState: {
    Dashboard: {
      Tabs: [
        {
          Name: 'Default',
          Toolbars: ['CustomToolbarButtons'],
        },
      ],
    },
    Theme: {CurrentTheme: 'light'},
    StyledColumn: {
      StyledColumns: [
        {
          ColumnId: 'language',
          Name: 'language Badge',
          BadgeStyle: {
            Badges: [
              {
                Rule: '[language] = "JavaScript"',
                IconProperties: {
                  Icon: {
                    name: 'javascript',
                  },
                  IconOnly: true,
                },
              },
              {
                Rule: '[language] = "TypeScript"',
                IconProperties: {
                  Icon: {
                    name: 'typescript',
                  },
                  IconOnly: true,
                },
              },
              {
                Rule: '[language] = "HTML"',
                IconProperties: {
                  Icon: {
                    name: 'html',
                  },
                  IconOnly: true,
                },
              },
            ],
          },
        },
        {
          ColumnId: 'name',
          Name: 'name Badge',
          BadgeStyle: {
            Badges: [
              {
                Rule: '[name] IN ("react", "angular", "vue", "stencil", "solid")',
                PillStyle: {
                  BackColor: 'var(--ab-color-palette-15)',
                  ForeColor: 'var(--ab-color-palette-13)',
                },
                IconProperties: {
                  Icon: {
                    name: 'popular',
                  },
                },
              },
            ],
          },
        },
      ],
    },
    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,
        },
      ],
    },
  },
};
```

### HTML Element Icon

This option allows users to provide the Icon as a DOM element or HTML string.

### The Element Icon Definition

The [`HTML Element Icon`](https://www.adaptabletools.com/docs/reference/adaptableelementicon.md) object has a single property:

| Property | Type | Description |
| --- | --- | --- |
| [element](https://www.adaptabletools.com/docs/reference/adaptableelementicon.md#element) | `HTMLElement \| string` | The icon to display, either a DOM element or HTML string |

**Example: Element Icons**

Providing Element Icons

- In this example we provide an Icon as an HTML Element, which we use in the button in the toolbar

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 {
  AdaptableButton,
  AdaptableOptions,
  CustomToolbarButtonContext,
} from '@adaptabletools/adaptable';

import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Adaptable Element Icons',
  dashboardOptions: {
    customToolbars: [
      {
        name: 'CustomToolbarButtons',
        title: 'Custom Filters',
        toolbarButtons: [
          {
            label: 'Button with CSS icon',
            icon: {
              element: `<i class="icon-rocket"></i>`,
            },
            buttonStyle: {
              variant: 'raised',
              tone: 'info',
            },

            onClick: (
              _button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              context.adaptableApi.filterApi.columnFilterApi.setColumnFilters([
                {
                  ColumnId: 'name',
                  Expression:
                    '[name] IN ("react", "angular", "vue", "stencil", "solid")',
                },
              ]);
            },
          },
        ],
      },
    ],
  },
  initialState: {
    Dashboard: {
      Tabs: [
        {
          Name: 'Default',
          Toolbars: ['CustomToolbarButtons'],
        },
      ],
    },
    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`**

```ts
.icon-rocket:after {
  content: '\1F680';
}
.icon-rocket {
  padding-right: 10px;
}
```

## Styling Icons

The style of an Adaptable Icon - for both [system](#system-icon) or [custom](#custom-icon) icons - may be customized with the following common properties, defined by [`AdaptableBaseIcon`](https://www.adaptabletools.com/docs/reference/adaptablebaseicon.md):

| Property | Type | Description |
| --- | --- | --- |
| [className](https://www.adaptabletools.com/docs/reference/adaptablebaseicon.md#classname) | `string` | The class name of the icon |
| [style](https://www.adaptabletools.com/docs/reference/adaptablebaseicon.md#style) | `React.CSSProperties` | CSS Properties |

## Application Icon

AdapTable allows users to supply an Application Icon which can be used in multiple places:

- Dashboard
- Settings Panel
- Anywhere where Icons are displayed (e.g Buttons)

This is provided in the `applicationIcon` property in [User Interface Options](https://www.adaptabletools.com/docs/technical-reference-ui/index.md).

### `applicationIcon`

Icon to display in Dashboard, Notifications and elsewhere

  [`AdaptableIcon`](https://www.adaptabletools.com/docs/reference/adaptableicon.md)

An Icon (of type [`AdaptableIcon`](https://www.adaptabletools.com/docs/reference/adaptableicon.md)) can be provided.

This will then be displayed in various places, e.g. in the top left corner of the [Dashboard](https://www.adaptabletools.com/docs/ui-dashboard/index.md) or in [Notfications](https://www.adaptabletools.com/docs/ui-tutorial-using-toast-notifications/index.md)

The Icon can be one of 3 types:

<b>System Icon</b>

This is one of the Icons provided by AdapTable (full list available in the [Adaptable Icon Library](https://www.adaptabletools.com/docs/ui-tutorial-creating-icon/index.md#appendix-adaptable-icon-library)).

```tsx
adaptableOptions.userInterfaceOptions = {
  applicationIcon: {
    name: 'cell-validation',
  },
};
```

<b>Custom Icon</b>

This is a fully Custom Icon to be provided by the developer via the `src` property.

```tsx
adaptableOptions.userInterfaceOptions = {
  applicationIcon: {
    src: 'https://www.adaptabletools.com/docs/img/favicon_white.png',
    style: {
      height: 50,
      width: 220,
    },
  },
};
```

<b>HTML Element Icon</b>

This is a reference to an HTML Element.

```tsx
adaptableOptions.userInterfaceOptions = {
  applicationIcon: {
    element: `<i class="icon-rocket"></i>`,
  },
};
```

**Example: Application Icon**

Providing an Application Icon

- This example defines a **Custom** Application Icon (defined in [User Interface Options](https://www.adaptabletools.com/docs/technical-reference-ui/index.md)), which is viewable:
  - in the top left of the [Dashboard](https://www.adaptabletools.com/docs/ui-dashboard/index.md)
  - in the [Settings Panel](https://www.adaptabletools.com/docs/ui-settings-panel/index.md)
  - in the Toast Notification when an Alert fires (by setting `showApplicationIcon` to _true_ in [Notification Options](https://www.adaptabletools.com/docs/technical-reference-notifications/index.md) )

- Change the value of any cell to trigger the Alert: note the Application Icon in the Toast Notification
- Open the [Settings Panel](https://www.adaptabletools.com/docs/ui-settings-panel/index.md) and see the Application Icon displayed

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: 'Application Icon',
  notificationsOptions: {
    showApplicationIcon: true,
  },
  settingsPanelOptions: {
    icon: 'ApplicationIcon',
  },
  userInterfaceOptions: {
    applicationIcon: {
      src: 'https://img.icons8.com/color/100px/bungalow',
    },
  },
  initialState: {
    Theme: {CurrentTheme: 'dark'},
    Alert: {
      AlertDefinitions: [
        {
          Name: 'alert-Info-58',
          Scope: {All: true},
          Rule: 'ANY_CHANGE()',
          MessageType: 'Info',
          AlertProperties: {
            DisplayNotification: true,
          },
        },
      ],
    },
    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,
        },
      ],
    },
  },
};
```

## Appendix: AdapTable Icon Library

This is the full list of System Icons available in AdapTable.
