# Extending Layouts

Canonical page: https://www.adaptabletools.com/docs/handbook-layouts-extending

- Layouts contain useful sets of column-related information
- This means that they do not include Format Columns, Styled Columns or Alerts etc
- AdapTable provides a mechanism for users who find this restriction too constraining
- Objects (e.g. Format Columns) can be extended into particular Layouts, so they only apply there
- Developers can also add bespoke Metadata to a Layout

At their core, [Layouts](https://www.adaptabletools.com/docs/handbook-layouts/index.md) are simply sets of **column-related properties**.

They contain details of Column visibility, order, sorting, grouping, aggregations, filters and related properties.

By default, Layouts **do not contain** other [Adaptable Objects](https://www.adaptabletools.com/docs/dev-guide-adaptable-state-initial-state/index.md#adaptable-objects) like styling, formatting, Alerts or Flashing Cells

This results in 2 types of "restrictions":

1.  all [Adaptable Objects](https://www.adaptabletools.com/docs/dev-guide-adaptable-state-initial-state/index.md#adaptable-objects) in [Adaptable State](https://www.adaptabletools.com/docs/dev-guide-adaptable-state/index.md) are automatically available in all Layouts, even though a user might prefer, for example, for some styles or Alerts to be applicable to one Layout but not another

2.  developers cannot add custom objects, or properties, to their Layouts

AdapTable therefore allows for Layouts to be extended in 2 ways to meet these twin limitations:

- **Layout Extensions** - so that some AdapTable objects apply only in selected Layouts

- **Metadata** - to enable developers to provide additional bespoke information in the Layout

## Layout Extensions

AdapTable allows Layouts to be extended to have knowledge of specific Adaptable Objects.

In other words developers - or runtime users - can specify that a particular Format Column, Styled Column or Alert is available in "LayoutA" but not "LayoutB".

This is managed via the `LayoutExtensions` property of [Layout State](https://www.adaptabletools.com/docs/technical-reference-layouts/index.md).

It is a collection of [`LayoutExtension`](https://www.adaptabletools.com/docs/reference/layoutextension.md) objects - each one names a Layout and lists, per Module, the **names** of the objects extended into that Layout.

The Modules that can be extended are:

- [Alert](https://www.adaptabletools.com/docs/handbook-alerting/index.md)
- [Custom Sort](https://www.adaptabletools.com/docs/handbook-custom-sorting/index.md)
- [Flashing Cell](https://www.adaptabletools.com/docs/handbook-flashing-cell/index.md)
- [Format Column](https://www.adaptabletools.com/docs/handbook-column-formatting/index.md)
- [Plus Minus](https://www.adaptabletools.com/docs/handbook-editing-plus-minus/index.md)
- [Shortcut](https://www.adaptabletools.com/docs/handbook-editing-shortcut/index.md)
- [Styled Column](https://www.adaptabletools.com/docs/handbook-styled-column-overview/index.md)

| Property | Type | Description |
| --- | --- | --- |
| [Alert](https://www.adaptabletools.com/docs/reference/layoutextension.md#alert) | `string[]` | Names of Alert Definitions which apply in this Layout |
| [CustomSort](https://www.adaptabletools.com/docs/reference/layoutextension.md#customsort) | `string[]` | Names of Custom Sorts which apply in this Layout |
| [FlashingCell](https://www.adaptabletools.com/docs/reference/layoutextension.md#flashingcell) | `string[]` | Names of Flashing Cell Definitions which apply in this Layout |
| [FormatColumn](https://www.adaptabletools.com/docs/reference/layoutextension.md#formatcolumn) | `string[]` | Names of Format Columns which apply in this Layout |
| [LayoutName](https://www.adaptabletools.com/docs/reference/layoutextension.md#layoutname) | `string` | Name of the Layout being extended (Mandatory) |
| [PlusMinus](https://www.adaptabletools.com/docs/reference/layoutextension.md#plusminus) | `string[]` | Names of Plus Minus Nudges which apply in this Layout |
| [Shortcut](https://www.adaptabletools.com/docs/reference/layoutextension.md#shortcut) | `string[]` | Names of Shortcuts which apply in this Layout |
| [StyledColumn](https://www.adaptabletools.com/docs/reference/layoutextension.md#styledcolumn) | `string[]` | Names of Styled Columns which apply in this Layout |

```ts {6-15}
// `Bold License` applies in `Trading` and `Research`;  `Highlight TypeScript` and `Big Price Move` only in `Trading`
// Every other Format Column and Alert applies everywhere
Layout: {
  CurrentLayout: 'Trading',
  Layouts: [...],
  LayoutExtensions: [
    {
      LayoutName: 'Trading',
      FormatColumn: ['Bold License', 'Highlight TypeScript'],
      Alert: ['Big Price Move'],
    },
    {
      LayoutName: 'Research',
      FormatColumn: ['Bold License'],
    },
  ],
},
```

- The rules for Extending Layouts are simple and consistently applied:
  - An object which is **not listed** in any Layout Extension is **global** - it applies in every Layout (this is the default)
  - Once an object is listed in one or more Layout Extensions, it applies **only** in those Layouts

### Understanding how Layout Extensions are kept in sync

Because objects are referenced by `Name`, each object must have a Name which is unique within its Module.

AdapTable keeps the registry up to date automatically:

- **Renaming a Layout** updates the `LayoutName` of its Layout Extension
- **Deleting a Layout** removes its Layout Extension
- **Renaming an object** updates its name wherever it is listed
- **Deleting an object** removes it from every Layout

- Neither the Layout nor the extended objects are changed - the association is stored only in `LayoutExtensions`
- Changing Layout Extensions updates Layout State but does not fire the [Layout Changed Event](https://www.adaptabletools.com/docs/handbook-layouts-monitoring/index.md)

**Example: Extended Layouts**

Extending Layouts to limit the Scope of Objects

- This demo illustrates how to use `LayoutExtensions` in Layout State to limit objects to 2 Layouts - `First Layout` and `Second Layout` - with similar configuration
- There are 5 [Format Columns](https://www.adaptabletools.com/docs/handbook-column-formatting/index.md) provided:
  - `License` is **bold** - `First Layout`
  - `Language` is blue where value is 'TypeScript' - `First Layout`
  - `Github Stars` has a bespoke Style and a Display Format - `Second Layout`
  - Whole row is orange where `Language` value is 'HTML' - `Second Layout`
  - `Date` Columns are _Italicised_ and have a Display Format - not extended, so it applies in **every** Layout
- Additionally we provide 5 [Styled Columns](https://www.adaptabletools.com/docs/handbook-styled-column-overview/index.md):
  - `Name` has a Badge Style - `First Layout`
  - `Open PRs` has a Gradient Column - `First Layout`
  - `Closed Issues` has a Percent Bar - `Second Layout`
  - `History` has a different Sparkline Column in `First Layout` and `Second Layout`
- We set `enableLayoutExtensionsUI` to _true_ in [Layout Options](https://www.adaptabletools.com/docs/technical-reference-layouts/index.md) so that users can change which Layouts an object belongs to

- Switch between the 2 Layouts to see the different [Format Columns](https://www.adaptabletools.com/docs/handbook-column-formatting/index.md) and [Styled Columns](https://www.adaptabletools.com/docs/handbook-styled-column-overview/index.md) applied
- Open the Format Column section of the Settings Panel and use the buttons in the **Layouts** row to change which Layouts an object belongs to
- Tick "Show Format Columns not available in current Layout" to see objects extended into other Layouts
- Edit a Format Column and use the **Layouts** step in the wizard

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

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template, with charts]
  columnDefs.ts
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts
  styles.css           [template]
index.html             [template]
package.json           [template] + ag-charts-enterprise
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: 'Extended Layouts',
  layoutOptions: {
    enableLayoutExtensionsUI: true,
  },
  initialState: {
    Dashboard: {
      ModuleButtons: ['Layout', 'FormatColumn', 'StyledColumn'],
      PinnedToolbars: ['Layout'],
    },
    StatusBar: {
      StatusBars: [
        {
          Key: 'Center Panel',
          StatusBarPanels: ['Layout'],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'First Layout',
      Layouts: [
        {
          TableColumns: [
            'name',
            'history',
            'license',
            'language',
            'github_stars',
            'open_pr_count',
            'closed_issues_count',
            'created_at',
            'updated_at',
            'pushed_at',
            'has_wiki',
            'github_watchers',
            'description',
            'open_issues_count',
            'closed_pr_count',
            'has_projects',
            'has_pages',
            'week_issue_change',
          ],
          Name: 'First Layout',
          AutoSizeColumns: true,
        },
        {
          TableColumns: [
            'name',
            'language',
            'github_stars',
            'open_pr_count',
            'history',
            'closed_issues_count',
            'created_at',
            'updated_at',
            'pushed_at',
            'license',
            'has_wiki',
            'github_watchers',
            'description',
            'open_issues_count',
            'closed_pr_count',
            'has_projects',
            'has_pages',
            'week_issue_change',
          ],
          Name: 'Second Layout',
          ColumnSizing: {
            history: {Width: 175},
          },
          AutoSizeColumns: true,
        },
      ],
      // Objects listed here only apply in that Layout; objects not listed (e.g. 'formatColumn-date') apply everywhere
      LayoutExtensions: [
        {
          LayoutName: 'First Layout',
          FormatColumn: ['formatColumn-license', 'formatColumn-language'],
          StyledColumn: ['name Badge', 'open_pr_count Gradient', 'history Line Sparkline'],
        },
        {
          LayoutName: 'Second Layout',
          FormatColumn: ['formatColumn-github_stars', 'formatColumn-all'],
          StyledColumn: ['closed_issues_count PercentBar', 'history Area Sparkline'],
        },
      ],
    },
    StyledColumn: {
      StyledColumns: [
        {
          ColumnId: 'name',
          Name: 'name Badge',
          BadgeStyle: {
            Badges: [
              {
                PillStyle: {
                  BackColor: 'DarkGray',
                },
              },
            ],
          },
        },
        {
          ColumnId: 'open_pr_count',
          Name: 'open_pr_count Gradient',
          GradientStyle: {
            CellRanges: [
              {
                Min: 0,
                Max: 254,
                Color: '#a52a2a',
              },
            ],
          },
        },
        {
          ColumnId: 'closed_issues_count',
          Name: 'closed_issues_count PercentBar',
          PercentBarStyle: {
            RangeValueType: 'Number',
            CellRanges: [
              {
                Min: 0,
                Max: 21706,
                Color: 'purple',
              },
            ],
            CellTextProperties: {
              CellTextLayout: {
                PercentValue: {Horizontal: 'Left', Vertical: 'Below'},
              },
            },
          },
        },
        {
          ColumnId: 'history',
          Name: 'history Line Sparkline',
          SparklineStyle: {
            options: {
              type: 'line',
              stroke: 'rgb(124, 255, 178)',
              strokeWidth: 2,
              padding: {
                top: 5,
                bottom: 5,
              },
              marker: {
                enabled: true,
                size: 3,
                shape: 'diamond',
              },
            },
          },
        },
        {
          ColumnId: 'history',
          Name: 'history Area Sparkline',
          SparklineStyle: {
            options: {
              type: 'area',
              fill: 'rgba(216, 204, 235, 0.3)',
              stroke: 'rgb(119,77,185)',
              axis: {
                type: 'category',
                stroke: 'rgb(204, 204, 235)',
              },
            },
          },
        },
      ],
    },

    FormatColumn: {
      FormatColumns: [
        {
          Name: 'formatColumn-license',
          Scope: {
            ColumnIds: ['license'],
          },
          Style: {
            FontWeight: 'Bold',
          },
        },
        {
          Name: 'formatColumn-github_stars',
          Scope: {
            ColumnIds: ['github_stars'],
          },
          Style: {
            ForeColor: '#c2bb00',
            BackColor: '#f5f5f5',
          },
          DisplayFormat: {
            Formatter: 'NumberFormatter',
            Options: {
              Prefix: 'Stars: ',
            },
          },
        },
        {
          Name: 'formatColumn-date',
          Scope: {
            DataTypes: ['date'],
          },
          Style: {
            FontStyle: 'Italic',
            Alignment: 'Center',
          },
          DisplayFormat: {
            Formatter: 'DateFormatter',
            Options: {
              Pattern: 'MMM do yyyy',
            },
          },
        },
        {
          Name: 'formatColumn-language',
          Style: {
            BackColor: 'var(--ab-color-palette-25)',
          },
          Scope: {
            ColumnIds: ['language'],
          },
          Rule: '[language] = "TypeScript"',
        },
        {
          Name: 'formatColumn-all',
          Style: {
            BackColor: 'var(--ab-color-palette-32)',
          },
          Scope: {
            All: true,
          },
          Rule: '[language] = "HTML"',
        },
      ],
    },
  },
};
```

**`src/columnDefs.ts`**

```ts
import {ColDef} from 'ag-grid-enterprise';

export const columnDefs: ColDef[] = [
  {
    field: 'name',
    cellDataType: 'text',
    sortable: true,
  },
  {
    field: 'language',
    cellDataType: 'text',
    enablePivot: true,
    enableRowGroup: true,
  },
  {
    field: 'github_stars',
    headerName: 'GitHub Stars',
    cellDataType: 'number',
    enableValue: true,
  },
  {
    field: 'github_watchers',
    headerName: 'GitHub Watchers',
    cellDataType: 'number',
    enableValue: true,
  },
  {
    field: 'license',
    cellDataType: 'text',
    editable: false,
    enablePivot: true,
    enableRowGroup: true,
  },
  {
    field: 'week_issue_change',
    headerName: 'Issue Change',
    cellDataType: 'number',
    enableValue: true,
  },
  {
    field: 'created_at',
    headerName: 'Created',
    cellDataType: 'date',
  },
  {
    field: 'has_wiki',
    headerName: 'Has Wiki',
    cellDataType: 'boolean',
    enablePivot: true,
    enableRowGroup: true,
  },
  {
    field: 'updated_at',
    headerName: 'Updated',
    cellDataType: 'date',
  },
  {
    field: 'pushed_at',
    headerName: 'Pushed',
    cellDataType: 'date',
  },
  {
    field: 'description',
    cellDataType: 'text',
    sortable: false,
  },
  {
    field: 'open_issues_count',
    headerName: 'Open Issues',
    cellDataType: 'number',
    enableValue: true,
  },
  {
    field: 'closed_issues_count',
    headerName: 'Closed Issues',
    cellDataType: 'number',
    enableValue: true,
  },

  {
    field: 'open_pr_count',
    headerName: 'Open PRs',
    cellDataType: 'number',
    enableValue: true,
  },
  {
    field: 'closed_pr_count',
    headerName: 'Closed PRs',
    cellDataType: 'number',
    enableValue: true,
  },
  {
    field: 'has_projects',
    headerName: 'Has Projects',
    cellDataType: 'boolean',
  },
  {
    field: 'has_pages',
    headerName: 'Has Pages',
    cellDataType: 'boolean',
  },
  {
    field: 'topics',
    cellDataType: 'textArray',
    editable: false,
    sortable: false,
  },
  {
    field: 'id',
    cellDataType: 'number',
    hide: true,
    editable: false,
  },
  {
    headerName: 'History',
    colId: 'history',
    field: 'history',
    editable: false,
    floatingFilter: false,
    filter: false,
    resizable: true,
    cellDataType: 'numberArray',
  },
];
```

**`src/rowData.ts`**

```ts
export const rowData = [
  {
    id: 10270250,
    name: 'react',
    full_name: 'facebook/react',
    html_url: 'https://github.com/facebook/react',
    description:
      'A declarative, efficient, and flexible JavaScript library for building user interfaces.',
    created_at: new Date('2013-05-24T16:15:54').toDateString(),
    updated_at: new Date('2021-12-20T09:03:49').toDateString(),
    pushed_at: new Date('2021-12-19T14:34:59').toDateString(),
    homepage: 'https://reactjs.org',
    github_stars: 179429,
    language: 'JavaScript',
    forks_count: 36403,
    open_issues_count: 920,
    license: 'MIT License',
    topics: ['declarative', 'frontend', 'javascript', 'library', 'react', 'ui'],
    github_watchers: 6671,
    has_projects: true,
    has_wiki: true,
    has_pages: true,
    closed_issues_count: 10326,
    open_pr_count: 249,
    closed_pr_count: 11408,
    week_issue_change: 5,
    history: [27, 5, 13, 25, 12, 17, 11, 27],
  },
  {
    id: 24195339,
    name: 'angular',
    full_name: 'angular/angular',
    html_url: 'https://github.com/angular/angular',
    description: 'The modern web developer’s platform',
    created_at: new Date('2014-09-18T16:12:01').toDateString(),
    updated_at: new Date('2021-12-20T08:37:07').toDateString(),
    pushed_at: new Date('2021-12-19T21:54:01').toDateString(),
    homepage: 'https://angular.io',
    github_stars: 78348,
    language: 'TypeScript',
    forks_count: 20569,
    open_issues_count: 1889,
    license: 'MIT License',
    topics: [
      'angular',
      'javascript',
      'pwa',
      'typescript',
      'web',
      'web-framework',
      'web-performance',
    ],
    github_watchers: 3119,
    has_projects: true,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 21706,
    open_pr_count: 159,
    closed_pr_count: 20052,
    week_issue_change: 12,
    history: [22, 28, 17, 25, 26, 20, 2, 30, 17, 19, 12, 9, 25, 22, 18],
  },
  {
    id: 11730342,
    name: 'vue',
    full_name: 'vuejs/vue',
    html_url: 'https://github.com/vuejs/vue',
    description:
      '🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.',
    created_at: new Date('2013-07-29T03:24:51').toDateString(),
    updated_at: new Date('2021-12-20T08:47:06').toDateString(),
    pushed_at: new Date('2021-12-20T08:10:16').toDateString(),
    homepage: 'http://vuejs.org',
    github_stars: 191435,
    language: 'JavaScript',
    forks_count: 30945,
    open_issues_count: 546,
    license: 'MIT License',
    topics: ['framework', 'frontend', 'javascript', 'vue'],
    github_watchers: 6187,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 9318,
    open_pr_count: 224,
    closed_pr_count: 1878,
    week_issue_change: -9,
    history: [22, 22, 24, 18, 11, 28],
  },
  {
    id: 74293321,
    name: 'svelte',
    full_name: 'sveltejs/svelte',
    html_url: 'https://github.com/sveltejs/svelte',
    description: 'Cybernetically enhanced web apps',
    created_at: new Date('2016-11-20T18:13:05').toDateString(),
    updated_at: new Date('2021-12-20T08:56:37').toDateString(),
    pushed_at: new Date('2021-12-19T14:53:30').toDateString(),
    homepage: 'https://svelte.dev',
    github_stars: 53935,
    language: 'TypeScript',
    forks_count: 2584,
    open_issues_count: 604,
    license: 'MIT License',
    topics: ['compiler', 'template', 'ui'],
    github_watchers: 874,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 3549,
    open_pr_count: 104,
    closed_pr_count: 2738,
    week_issue_change: 14,
    history: [16, 21, 3, 1, 1, 11, 30, 20, 27, 18],
  },
  {
    id: 224663696,
    name: 'alpine',
    full_name: 'alpinejs/alpine',
    html_url: 'https://github.com/alpinejs/alpine',
    description:
      'A rugged, minimal framework for composing JavaScript behavior in your markup. ',
    created_at: new Date('2019-11-28T13:51:55').toDateString(),
    updated_at: new Date('2021-12-20T08:12:43').toDateString(),
    pushed_at: new Date('2021-12-14T16:02:26').toDateString(),
    homepage: 'https://alpinejs.dev',
    github_stars: 19338,
    language: 'HTML',
    forks_count: 837,
    open_issues_count: 19,
    license: 'MIT License',
    topics: [],
    github_watchers: 202,
    has_projects: false,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 544,
    open_pr_count: 13,
    closed_pr_count: 546,
    week_issue_change: 21,
    history: [15, 13, 26, 8, 19, 12, 25, 12],
  },
  {
    id: 95797174,
    name: 'lit',
    full_name: 'lit/lit',
    html_url: 'https://github.com/lit/lit',
    description:
      'Lit is a simple library for building fast, lightweight web components.',
    created_at: new Date('2017-06-29T16:27:16').toDateString(),
    updated_at: new Date('2021-12-20T07:20:35').toDateString(),
    pushed_at: new Date('2021-12-17T03:45:26').toDateString(),
    homepage: 'https://lit.dev',
    github_stars: 9752,
    language: 'JavaScript',
    forks_count: 528,
    open_issues_count: 207,
    license: 'BSD 3-Clause',
    topics: ['html-templates', 'lit', 'lit-element', 'lit-html'],
    github_watchers: 204,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 895,
    open_pr_count: 53,
    closed_pr_count: 1138,
    week_issue_change: -45,
    history: [17, 16, 23, 16, 3, 7],
  },
  {
    id: 76694515,
    name: 'stimulus',
    full_name: 'hotwired/stimulus',
    html_url: 'https://github.com/hotwired/stimulus',
    description: 'A modest JavaScript framework for the HTML you already have',
    created_at: new Date('2016-12-17T00:19:29').toDateString(),
    updated_at: new Date('2021-12-20T07:20:01').toDateString(),
    pushed_at: new Date('2021-12-17T20:47:34').toDateString(),
    homepage: 'https://stimulus.hotwired.dev/',
    github_stars: 11049,
    language: 'TypeScript',
    forks_count: 316,
    open_issues_count: 17,
    license: 'MIT License',
    topics: [],
    github_watchers: 221,
    has_projects: false,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 282,
    open_pr_count: 5,
    closed_pr_count: 191,
    week_issue_change: -11,
    history: [
      5, 10, 12, 21, 13, 15, 17, 13, 22, 2, 13, 10, 11, 5, 5, 7, 29, 16,
    ],
  },
  {
    id: 1801829,
    name: 'ember.js',
    full_name: 'emberjs/ember.js',
    html_url: 'https://github.com/emberjs/ember.js',
    description:
      'Ember.js - A JavaScript framework for creating ambitious web applications',
    created_at: new Date('2011-05-25T23:39:40').toDateString(),
    updated_at: new Date('2021-12-19T07:57:31').toDateString(),
    pushed_at: new Date('2021-12-20T07:15:54').toDateString(),
    homepage: 'https://emberjs.com',
    github_stars: 22093,
    language: 'JavaScript',
    forks_count: 4253,
    open_issues_count: 427,
    license: 'MIT License',
    topics: ['ember', 'hacktoberfest', 'javascript', 'javascript-framework'],
    github_watchers: 908,
    has_projects: true,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 6187,
    open_pr_count: 94,
    closed_pr_count: 9574,
    week_issue_change: -22,
    history: [
      30, 19, 4, 25, 24, 19, 29, 20, 29, 19, 28, 13, 27, 2, 7, 7, 21, 25, 23,
      15,
    ],
  },
  {
    id: 82095231,
    name: 'stencil',
    full_name: 'ionic-team/stencil',
    html_url: 'https://github.com/ionic-team/stencil',
    description:
      'A toolchain for building scalable, enterprise-ready component systems on top of TypeScript.',
    created_at: new Date('2017-02-15T18:57:07').toDateString(),
    updated_at: new Date('2021-12-20T05:46:50').toDateString(),
    pushed_at: new Date('2021-12-16T21:15:17').toDateString(),
    homepage: 'https://stenciljs.com',
    github_stars: 9884,
    language: 'TypeScript',
    forks_count: 641,
    open_issues_count: 499,
    license: 'Other',
    topics: [
      'custom-elements',
      'ionic',
      'progressive-web-app',
      'pwa',
      'ssg',
      'ssr',
      'static-site-generator',
      'stencil',
      'stenciljs',
      'typescript',
      'webcomponents',
    ],
    github_watchers: 203,
    has_projects: true,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 1929,
    open_pr_count: 46,
    closed_pr_count: 743,
    week_issue_change: 12,
    history: [25, 17, 13, 5, 2, 18, 26, 11, 23, 23],
  },
  {
    id: 130884470,
    name: 'solid',
    full_name: 'solidjs/solid',
    html_url: 'https://github.com/solidjs/solid',
    description:
      'A declarative, efficient, and flexible JavaScript library for building user interfaces.',
    created_at: new Date('2018-04-24T16:36:27').toDateString(),
    updated_at: new Date('2021-12-20T08:29:47').toDateString(),
    pushed_at: new Date('2021-12-19T21:06:01').toDateString(),
    homepage: 'https://solidjs.com',
    github_stars: 13119,
    language: 'TypeScript',
    forks_count: 330,
    open_issues_count: 21,
    license: 'MIT License',
    topics: [
      'declarative',
      'fine-grained',
      'javascript',
      'jsx',
      'performance',
      'proxies',
      'reactive',
      'solid',
    ],
    github_watchers: 161,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 366,
    open_pr_count: 3,
    closed_pr_count: 164,
    week_issue_change: 23,
    history: [14, 22, 5, 13, 5, 30, 28, 15, 19, 11, 28, 24, 4, 2, 10, 30],
  },
  {
    id: 17814354,
    name: 'mithril.js',
    full_name: 'MithrilJS/mithril.js',
    html_url: 'https://github.com/MithrilJS/mithril.js',
    description: 'A JavaScript Framework for Building Brilliant Applications',
    created_at: new Date('2014-03-17T01:59:39').toDateString(),
    updated_at: new Date('2021-12-20T03:17:55').toDateString(),
    pushed_at: new Date('2021-11-24T10:16:47').toDateString(),
    homepage: 'https://mithril.js.org',
    github_stars: 13064,
    language: 'JavaScript',
    forks_count: 940,
    open_issues_count: 173,
    license: 'MIT License',
    topics: [
      'framework',
      'javascript',
      'mithril',
      'router',
      'vdom',
      'virtual-dom',
      'xhr',
    ],
    github_watchers: 324,
    has_projects: true,
    has_wiki: true,
    has_pages: true,
    closed_issues_count: 1368,
    open_pr_count: 28,
    closed_pr_count: 1144,
    week_issue_change: 57,
    history: [25, 18, 2, 23, 19],
  },
  {
    id: 167174,
    name: 'jquery',
    full_name: 'jquery/jquery',
    html_url: 'https://github.com/jquery/jquery',
    description: 'jQuery JavaScript Library',
    created_at: new Date('2009-04-03T15:20:14').toDateString(),
    updated_at: new Date('2021-12-20T06:13:48').toDateString(),
    pushed_at: new Date('2021-12-17T16:50:04').toDateString(),
    homepage: 'https://jquery.com',
    github_stars: 55666,
    language: 'JavaScript',
    forks_count: 20187,
    open_issues_count: 84,
    license: 'MIT License',
    topics: ['jquery'],
    github_watchers: 3306,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 2083,
    open_pr_count: 13,
    closed_pr_count: 2692,
    week_issue_change: 15,
    history: [1, 7, 3, 3, 3, 22, 1, 12, 16, 15, 22],
  },
  {
    id: 5532320,
    name: 'polymer',
    full_name: 'Polymer/polymer',
    html_url: 'https://github.com/Polymer/polymer',
    description: 'Our original Web Component library.',
    created_at: new Date('2012-08-23T20:56:30').toDateString(),
    updated_at: new Date('2021-12-19T05:05:03').toDateString(),
    pushed_at: new Date('2021-12-07T22:20:44').toDateString(),
    homepage: 'https://polymer-library.polymer-project.org/',
    github_stars: 21724,
    language: 'HTML',
    forks_count: 2026,
    open_issues_count: 281,
    license: 'Other',
    topics: ['polymer', 'web-components'],
    github_watchers: 894,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 3648,
    open_pr_count: 26,
    closed_pr_count: 1404,
    week_issue_change: 9,
    history: [5, 6, 25, 7, 17, 6, 19, 27, 21, 5, 18],
  },
  {
    id: 952189,
    name: 'backbone',
    full_name: 'jashkenas/backbone',
    html_url: 'https://github.com/jashkenas/backbone',
    description:
      'Give your JS App some Backbone with Models, Views, Collections, and Events',
    created_at: new Date('2010-09-30T19:41:28').toDateString(),
    updated_at: new Date('2021-12-19T05:50:57').toDateString(),
    pushed_at: new Date('2020-05-19T16:52:55').toDateString(),
    homepage: 'http://backbonejs.org',
    github_stars: 27840,
    language: 'JavaScript',
    forks_count: 5608,
    open_issues_count: 85,
    license: 'MIT License',
    topics: [],
    github_watchers: 1365,
    has_projects: true,
    has_wiki: true,
    has_pages: true,
    closed_issues_count: 2335,
    open_pr_count: 32,
    closed_pr_count: 1797,
    week_issue_change: -14,
    history: [
      25, 26, 4, 14, 6, 22, 1, 4, 24, 28, 6, 28, 13, 22, 24, 8, 8, 8, 8, 27,
    ],
  },
  {
    id: 757363,
    name: 'knockout',
    full_name: 'knockout/knockout',
    html_url: 'https://github.com/knockout/knockout',
    description:
      'Knockout makes it easier to create rich, responsive UIs with JavaScript',
    created_at: new Date('2010-07-05T08:08:34').toDateString(),
    updated_at: new Date('2021-12-18T17:20:52').toDateString(),
    pushed_at: new Date('2021-10-09T07:42:49').toDateString(),
    homepage: 'http://knockoutjs.com/',
    github_stars: 10122,
    language: 'JavaScript',
    forks_count: 1571,
    open_issues_count: 362,
    license: 'Other',
    topics: ['data-binding', 'javascript', 'knockout', 'mvvm'],
    github_watchers: 549,
    has_projects: true,
    has_wiki: true,
    has_pages: true,
    closed_issues_count: 1534,
    open_pr_count: 72,
    closed_pr_count: 670,
    week_issue_change: 63,
    history: [23, 19, 6, 28, 5],
  },
  {
    id: 191051391,
    name: 'redwood',
    full_name: 'redwoodjs/redwood',
    html_url: 'https://github.com/redwoodjs/redwood',
    description: 'The App Framework for Startups',
    created_at: new Date('2019-06-09T20:17:57').toDateString(),
    updated_at: new Date('2021-12-20T01:41:55').toDateString(),
    pushed_at: new Date('2021-12-20T00:37:09').toDateString(),
    homepage: 'https://redwoodjs.com',
    github_stars: 10334,
    language: 'TypeScript',
    forks_count: 431,
    open_issues_count: 269,
    license: 'MIT License',
    topics: [
      'apollo',
      'graphql',
      'hacktoberfest',
      'jamstack',
      'prisma',
      'react',
    ],
    github_watchers: 80,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 1071,
    open_pr_count: 35,
    closed_pr_count: 2602,
    week_issue_change: 14,
    history: [1, 21, 16, 8, 9, 13],
  },
  {
    id: 36040894,
    name: 'gatsby',
    full_name: 'gatsbyjs/gatsby',
    html_url: 'https://github.com/gatsbyjs/gatsby',
    description: 'Build blazing fast, modern apps and websites with React',
    created_at: new Date('2015-05-21T22:43:05').toDateString(),
    updated_at: new Date('2021-12-20T09:04:22').toDateString(),
    pushed_at: new Date('2021-12-20T08:04:34').toDateString(),
    homepage: 'https://www.gatsbyjs.com',
    github_stars: 51931,
    language: 'JavaScript',
    forks_count: 10049,
    open_issues_count: 359,
    license: 'MIT License',
    topics: [
      'blog',
      'compiler',
      'documentation-tool',
      'gatsby',
      'graphql',
      'react',
      'static-site-generator',
      'web-app',
    ],
    github_watchers: 853,
    has_projects: true,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 12975,
    open_pr_count: 180,
    closed_pr_count: 19058,
    week_issue_change: -34,
    history: [10, 13, 12, 22, 4, 14, 27, 11, 18, 9, 21, 12],
  },
  {
    id: 26316966,
    name: 'cyclejs',
    full_name: 'cyclejs/cyclejs',
    html_url: 'https://github.com/cyclejs/cyclejs',
    description:
      'A functional and reactive JavaScript framework for predictable code',
    created_at: new Date('2014-11-07T11:28:45').toDateString(),
    updated_at: new Date('2021-12-20T06:39:49').toDateString(),
    pushed_at: new Date('2021-12-17T11:03:37').toDateString(),
    homepage: 'http://cycle.js.org',
    github_stars: 9999,
    language: 'TypeScript',
    forks_count: 421,
    open_issues_count: 102,
    license: 'MIT License',
    topics: [
      'cyclejs',
      'framework',
      'functional-programming',
      'hacktoberfest',
      'javascript',
      'reactive-programming',
      'rxjs',
      'typescript',
    ],
    github_watchers: 205,
    has_projects: true,
    has_wiki: true,
    has_pages: true,
    closed_issues_count: 563,
    open_pr_count: 26,
    closed_pr_count: 301,
    week_issue_change: -2,
    history: [27, 19, 25, 1, 17, 16, 9, 17, 1, 25, 24, 13, 26, 7, 12, 7, 5],
  },
  {
    id: 42283287,
    name: 'preact',
    full_name: 'preactjs/preact',
    html_url: 'https://github.com/preactjs/preact',
    description:
      '⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.',
    created_at: new Date('2015-09-11T02:40:18').toDateString(),
    updated_at: new Date('2021-12-20T09:02:15').toDateString(),
    pushed_at: new Date('2021-12-17T23:21:58').toDateString(),
    homepage: 'https://preactjs.com',
    github_stars: 30538,
    language: 'JavaScript',
    forks_count: 1702,
    open_issues_count: 222,
    license: 'MIT License',
    topics: [
      'components',
      'dom',
      'jsx',
      'preact',
      'react',
      'vdom',
      'virtual-dom',
    ],
    github_watchers: 425,
    has_projects: true,
    has_wiki: true,
    has_pages: true,
    closed_issues_count: 1309,
    open_pr_count: 78,
    closed_pr_count: 1729,
    week_issue_change: -12,
    history: [
      18, 3, 17, 22, 11, 26, 6, 1, 21, 16, 12, 13, 15, 19, 11, 12, 10, 21, 3,
    ],
  },
  {
    id: 13142126,
    name: 'riot',
    full_name: 'riot/riot',
    html_url: 'https://github.com/riot/riot',
    description: 'Simple and elegant component-based UI library',
    created_at: new Date('2013-09-27T05:21:01').toDateString(),
    updated_at: new Date('2021-12-20T05:17:31').toDateString(),
    pushed_at: new Date('2021-12-17T20:09:25').toDateString(),
    homepage: 'https://riot.js.org',
    github_stars: 14597,
    language: 'JavaScript',
    forks_count: 1032,
    open_issues_count: 5,
    license: 'Other',
    topics: [
      'client-side',
      'customelement',
      'customelements',
      'customtags',
      'elegant',
      'framework',
      'javascript',
      'lite',
      'minimal',
      'simple',
      'view',
      'webcomponents',
    ],
    github_watchers: 412,
    has_projects: true,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 2147,
    open_pr_count: 0,
    closed_pr_count: 755,
    week_issue_change: 0,
    history: [[26, 30, 10, 4, 5, 29, 8, 8, 2, 28, 17, 10, 27, 18, 8, 20]],
  },
  {
    id: 121594173,
    name: 'aurelia',
    full_name: 'aurelia/aurelia',
    html_url: 'https://github.com/aurelia/aurelia',
    description:
      'Aurelia 2, a standards-based, front-end framework designed for high-performing, ambitious applications.',
    created_at: new Date('2018-02-15T05:22:58').toDateString(),
    updated_at: new Date('2021-12-19T04:23:43').toDateString(),
    pushed_at: new Date('2021-11-28T16:21:43').toDateString(),
    homepage: '',
    github_stars: 1142,
    language: 'TypeScript',
    forks_count: 121,
    open_issues_count: 143,
    license: 'MIT License',
    topics: [
      'aurelia',
      'cordova',
      'cross-platform',
      'electron',
      'framework',
      'frontend',
      'html',
      'javascript',
      'javascript-framework',
      'mobile',
      'pwa',
      'single-page-applications',
      'spa',
      'typescript',
      'web',
      'web-framework',
      'web-performance',
    ],
    github_watchers: 66,
    has_projects: true,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 214,
    open_pr_count: 17,
    closed_pr_count: 959,
    week_issue_change: 32,
    history: [13, 6, 10, 15, 16, 30, 25, 1],
  },
  {
    id: 70107786,
    name: 'next.js',
    full_name: 'vercel/next.js',
    html_url: 'https://github.com/vercel/next.js',
    description: 'The React Framework',
    created_at: new Date('2016-10-05T23:32:51').toDateString(),
    updated_at: new Date('2021-12-20T08:57:47').toDateString(),
    pushed_at: new Date('2021-12-20T08:21:58').toDateString(),
    homepage: 'https://nextjs.org',
    github_stars: 78446,
    language: 'JavaScript',
    forks_count: 15787,
    open_issues_count: 1361,
    license: 'MIT License',
    topics: [
      'blog',
      'browser',
      'compiler',
      'components',
      'hybrid',
      'nextjs',
      'node',
      'react',
      'server-rendering',
      'ssg',
      'static',
      'static-site-generator',
      'universal',
      'vercel',
    ],
    github_watchers: 1224,
    has_projects: false,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 10320,
    open_pr_count: 254,
    closed_pr_count: 9849,
    week_issue_change: 63,
    history: [30, 5, 1, 5, 18, 2, 13, 25, 27, 26, 20, 25, 18, 35],
  },
  {
    id: 71995937,
    name: 'nuxt.js',
    full_name: 'nuxt/nuxt.js',
    html_url: 'https://github.com/nuxt/nuxt.js',
    description: 'The Intuitive Vue(2) Framework',
    created_at: new Date('2016-10-26T11:18:47').toDateString(),
    updated_at: new Date('2021-12-20T08:27:45').toDateString(),
    pushed_at: new Date('2021-12-20T08:05:15').toDateString(),
    homepage: 'https://nuxtjs.org',
    github_stars: 38997,
    language: 'JavaScript',
    forks_count: 3157,
    open_issues_count: 464,
    license: 'Other',
    topics: [
      'framework',
      'isomorphic',
      'nuxt',
      'server-rendering',
      'ssr',
      'universal',
      'vue',
      'vue-router',
      'vuex',
      'web-app',
    ],
    github_watchers: 772,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 6129,
    open_pr_count: 30,
    closed_pr_count: 2869,
    week_issue_change: -18,
    history: [
      30, 4, 6, 28, 17, 30, 30, 20, 7, 26, 17, 4, 6, 3, 21, 24, 27, 30, 6, 5,
    ],
  },
  {
    id: 3214406,
    name: 'meteor',
    full_name: 'meteor/meteor',
    html_url: 'https://github.com/meteor/meteor',
    description: 'Meteor, the JavaScript App Platform',
    created_at: new Date('2012-01-19T01:58:17').toDateString(),
    updated_at: new Date('2021-12-20T06:36:27').toDateString(),
    pushed_at: new Date('2021-12-17T18:10:08').toDateString(),
    homepage: 'https://www.meteor.com',
    github_stars: 42742,
    language: 'JavaScript',
    forks_count: 5187,
    open_issues_count: 120,
    license: 'Other',
    topics: [
      'build-system',
      'framework',
      'hacktoberfest',
      'javascript',
      'meteor',
      'mongodb',
      'nodejs',
      'npm',
      'reactive-programming',
      'zero-configuration',
    ],
    github_watchers: 1642,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 8537,
    open_pr_count: 24,
    closed_pr_count: 2998,
    week_issue_change: 21,
    history: [29, 30, 28, 20, 1, 24],
  },
  {
    id: 43695474,
    name: 'quasar',
    full_name: 'quasarframework/quasar',
    html_url: 'https://github.com/quasarframework/quasar',
    description:
      'Quasar Framework - Build high-performance VueJS user interfaces in record time',
    created_at: new Date('2015-10-05T15:45:36').toDateString(),
    updated_at: new Date('2021-12-20T08:26:07').toDateString(),
    pushed_at: new Date('2021-12-19T23:18:50').toDateString(),
    homepage: 'https://quasar.dev',
    github_stars: 20095,
    language: 'JavaScript',
    forks_count: 2543,
    open_issues_count: 367,
    license: 'MIT License',
    topics: [
      'android',
      'browser-extension',
      'electron',
      'ios',
      'javascript',
      'material',
      'material-components',
      'material-design',
      'material-theme',
      'pwa',
      'quasar-framework',
      'server-side-rendering',
      'ssr',
      'vue',
      'vue-component',
      'vue-components',
      'vue2',
      'vuejs',
      'vuejs2',
    ],
    github_watchers: 488,
    has_projects: false,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 6097,
    open_pr_count: 97,
    closed_pr_count: 3424,
    week_issue_change: 1,
    history: [26, 12, 7, 13, 17, 18, 20, 1, 28, 23, 22, 2, 2, 22, 18, 29, 2],
  },
];
```

### Configuring Extended Layouts

Developers can set up Extended Layouts in Initial State.

### Setting up Extended Layouts

These are the steps required to extend Layouts:

Define any required Layout(s) in [Layout Initial State](https://www.adaptabletools.com/docs/technical-reference-layouts/index.md).

Create the Layouts as usual - nothing special is required.

```tsx {6,10}
Layout: {
  CurrentLayout: 'First Layout',
  Layouts: [
    {
      TableColumns: ['name', 'language', 'description'],
      Name: 'First Layout',
    },
    {
      TableColumns: ['license', 'has_wiki', 'has_pages'],
      Name: 'Second Layout',
    },
  ],
},
```

Create the other objects as usual, making sure each has a `Name` which is unique within its Module.

```tsx {4,9}
FormatColumn: {
  FormatColumns: [
    {
      Name: 'Bold Name',
      Scope: { ColumnIds: ['name'] },
      Style: { FontWeight: 'Bold' },
    },
    {
      Name: 'Italic Text',
      Scope: { ColumnIds: ['text'] },
      Style: { FontStyle: 'Italic' },
    },
  ],
},
```

Add a `LayoutExtensions` collection to Layout State with a Layout Extension for each Layout.

List - per Module - the names of the objects which should apply in it.

Objects not listed anywhere remain available in every Layout.

```tsx {4-13}
Layout: {
  CurrentLayout: 'First Layout',
  Layouts: [...],
  LayoutExtensions: [
    {
      LayoutName: 'First Layout',
      FormatColumn: ['Bold Name', 'Italic Text'],
    },
    {
      LayoutName: 'Second Layout',
      FormatColumn: ['Italic Text'],
    },
  ],
},
```

### Extending Layouts in the UI

Run-time Users can also manage which Layouts an object belongs to.

This is **off** by default - set `enableLayoutExtensionsUI` in [Layout Options](https://www.adaptabletools.com/docs/technical-reference-layouts/index.md) to _true_ to enable it

### `enableLayoutExtensionsUI`

Show controls for extending objects into Layouts

When set to _true_ (and there are at least 2 Layouts):

- the Wizard of each extendable object includes a **Layouts** step, listing all Layouts - leave it empty to make the object available in every Layout
- each object in the Settings Panel has a **Layouts** row with buttons to _Restrict to Current Layout_, _Add to Current Layout_, _Remove from Current Layout_ or _Make Available in All Layouts_

```ts {3}
const adaptableOptions: AdaptableOptions = {
  layoutOptions: {
    enableLayoutExtensionsUI: true,
  },
};
```

- Even if this property is set to _false_, extended objects show a read-only **Layouts** row in Settings Panel
- The Settings Panel displays a checkbox to show objects which are not available in the Current Layout

### Extending Layouts via API

[Layout API](https://www.adaptabletools.com/docs/technical-reference-layouts/index.md) contains 6 functions to read and change which objects are extended into which Layouts:

- `addObjectToLayout` - extends an object into a Layout (by default the Current Layout)
- `removeObjectFromLayout` - removes an object from a Layout; it becomes global if no Layouts remain
- `setLayoutsForObject` - extends an object into exactly the given Layouts (an empty list makes it global)
- `getLayoutsForObject` - returns the names of the Layouts an object is extended into
- `getLayoutExtensions` - returns all the objects extended into a Layout
- `setLayoutExtensions` - replaces all the objects extended into a Layout

### `addObjectToLayout`

Extends an object into a Layout

Extends the object into the given Layout (defaults to the Current Layout).

If the object was global, it now applies **only** in this Layout

```ts
// Extend the 'Bold License' Format Column into the Current Layout
adaptableApi.layoutApi.addObjectToLayout(boldLicense, 'FormatColumn');
```

### `removeObjectFromLayout`

Removes an object from a Layout

Removes the object from the given Layout (defaults to the Current Layout).

If this was the last Layout the object was extended into, it becomes global again (i.e. available in every Layout)

```ts
// Remove the 'Bold License' Format Column from the Current Layout
adaptableApi.layoutApi.removeObjectFromLayout(boldLicense, 'FormatColumn');
```

### `setLayoutsForObject`

Extends an object into exactly the given Layouts

Extends the object into the given Layouts, removing it from any others.

Pass an empty array to make the object global.

```ts
// Restrict 'Bold License' to the Trading and Research Layouts
adaptableApi.layoutApi.setLayoutsForObject(boldLicense, 'FormatColumn', [
  'Trading',
  'Research',
]);
```

### `getLayoutsForObject`

Returns the Layouts an object is extended into

Returns the names of the Layouts the object is extended into - an empty array means the object is global.

```ts
// Which Layouts is the 'Bold License' Format Column extended into?
const layouts = adaptableApi.layoutApi.getLayoutsForObject(
  boldLicense,
  'FormatColumn'
);
```

### `getLayoutExtensions`

Returns all the objects extended into a Layout

Returns the names of the objects, per Module, extended into the given Layout - i.e. its Layout Extension (without the `LayoutName`).

Often used together with `setLayoutExtensions` to copy or adjust a Layout's extensions.

```ts
// Read which objects are extended into the 'Trading' Layout
const tradingExtensions = adaptableApi.layoutApi.getLayoutExtensions('Trading');
```

### `setLayoutExtensions`

Replaces all the objects extended into a Layout

Replaces the objects extended into the given Layout.

Pass an empty object to make those objects global again (unless they are still extended into other Layouts).

Often used together with `getLayoutExtensions` to copy or adjust an existing Layout's extensions.

```ts
// Restrict the 'Trading' Layout to these objects
adaptableApi.layoutApi.setLayoutExtensions('Trading', {
  FormatColumn: ['Bold License', 'Highlight TypeScript'],
  Alert: ['Big Price Move'],
});
```

Layout API also contains `renameLayout` which renames a Layout and keeps its Layout Extensions

**Example: Managing Layout Extensions with the API**

Changing which Layouts an object belongs to at run-time

- This demo has 3 Layouts - `Trading`, `Research` and `Audit` - and a single Format Column (`Bold License`) which initially applies in all of them
- A Custom Toolbar provides 3 buttons which call Layout API:
  - _Restrict to Current Layout_ - `setLayoutsForObject` with the Current Layout
  - _Add to Current Layout_ - `addObjectToLayout`
  - _Make Available Everywhere_ - `setLayoutsForObject` with an empty array
- After each change we call `getLayoutsForObject` and display the result as a System Status message

- Click _Restrict to Current Layout_, then switch Layouts and note that the `License` Column is no longer styled
- In another Layout, click _Add to Current Layout_ and note that the Format Column now applies in both Layouts
- Click _Make Available Everywhere_ to restore the default

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

const licenseFormat: FormatColumn = {
  Name: 'Bold License',
  Scope: {
    ColumnIds: ['license'],
  },
  Style: {
    FontWeight: 'Bold',
    ForeColor: 'var(--ab-color-palette-32)',
  },
};

const showExtensionInfo = (adaptableApi: AdaptableApi) => {
  const layoutNames = adaptableApi.layoutApi.getLayoutsForObject(
    licenseFormat,
    'FormatColumn'
  );
  adaptableApi.systemStatusApi.setInfoSystemStatus(
    layoutNames.length
      ? `'Bold License' is in: ${layoutNames.join(', ')}`
      : `'Bold License' is available in all Layouts`
  );
};

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Layout Extensions API',
  layoutOptions: {
    enableLayoutExtensionsUI: true,
  },
  dashboardOptions: {
    customToolbars: [
      {
        name: 'LayoutExtensionsToolbar',
        title: "'Bold License' Format Column",
        toolbarButtons: [
          {
            label: 'Restrict to Current Layout',
            onClick: (
              button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              const layoutApi = context.adaptableApi.layoutApi;
              layoutApi.setLayoutsForObject(licenseFormat, 'FormatColumn', [
                layoutApi.getCurrentLayoutName(),
              ]);
              showExtensionInfo(context.adaptableApi);
            },
            buttonStyle: {tone: 'info', variant: 'text'},
          },
          {
            label: 'Add to Current Layout',
            onClick: (
              button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              // defaults to the Current Layout
              context.adaptableApi.layoutApi.addObjectToLayout(
                licenseFormat,
                'FormatColumn'
              );
              showExtensionInfo(context.adaptableApi);
            },
            buttonStyle: {tone: 'success', variant: 'text'},
          },
          {
            label: 'Make Available Everywhere',
            onClick: (
              button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              context.adaptableApi.layoutApi.setLayoutsForObject(
                licenseFormat,
                'FormatColumn',
                []
              );
              showExtensionInfo(context.adaptableApi);
            },
            buttonStyle: {tone: 'warning', variant: 'text'},
          },
        ],
      },
    ],
  },
  initialState: {
    Dashboard: {
      ModuleButtons: ['Layout', 'FormatColumn', 'SystemStatus'],
      Tabs: [
        {
          Name: 'Demo',
          Toolbars: ['LayoutExtensionsToolbar', 'Layout', 'SystemStatus'],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Trading',
      Layouts: [
        {
          Name: 'Trading',
          TableColumns: [
            'name',
            'license',
            'language',
            'github_stars',
            'open_pr_count',
            'closed_issues_count',
          ],
          AutoSizeColumns: true,
        },
        {
          Name: 'Research',
          TableColumns: [
            'name',
            'language',
            'license',
            'description',
            'created_at',
            'updated_at',
          ],
          AutoSizeColumns: true,
        },
        {
          Name: 'Audit',
          TableColumns: ['name', 'license', 'has_wiki', 'has_pages', 'pushed_at'],
          AutoSizeColumns: true,
        },
      ],
    },
    FormatColumn: {
      FormatColumns: [licenseFormat],
    },
  },
};
```

### Creating Extended Layouts

An [`ExtendedLayout`](https://www.adaptabletools.com/docs/reference/extendedlayout.md) is a composite object which contains a Layout together with the objects extended into it:

| Property | Type | Description |
| --- | --- | --- |
| [Extensions](https://www.adaptabletools.com/docs/reference/extendedlayout.md#extensions) | [`ExtendedLayoutObject`](https://www.adaptabletools.com/docs/reference/extendedlayoutobject.md)`[]` | Object to be included in the Layout |
| [Layout](https://www.adaptabletools.com/docs/reference/extendedlayout.md#layout) | [`Layout`](https://www.adaptabletools.com/docs/reference/layout.md) | Layout being extended |

The `createOrUpdateExtendedLayout` function in [Layout API](https://www.adaptabletools.com/docs/technical-reference-layouts/index.md) enables creating or updating Extended Layouts.

### `createOrUpdateExtendedLayout`

Receives an Extended Layout and saves it, and all extended Objects, to State

This function receives an Extended Layout and saves it to State:

- the Layout is saved with the other Layouts
- any extended objects which do not yet exist are added to the relevant Module
- the Layout's Layout Extension is set to exactly the objects provided

Any objects previously extended into the Layout, but not included in the Extended Layout, are removed from it

```ts {10,11}
// Create an Extended Layout with a Styled Column
const extendedLayout: ExtendedLayout = {
  Layout: importedLayout, // the Layout object to import
  Extensions: [
    {
      Module: 'StyledColumn',
      Object: badgeStyle, // a previously defined Badge Style
    },
  ],
};
// Import the Extended Layout and then Select it to be current
adaptableApi.layoutApi.createOrUpdateExtendedLayout(extendedLayout);
adaptableApi.layoutApi.setLayout(importedLayout.Name);
```

### Retrieving Extended Layouts

AdapTable also provides the `getExtendedLayoutByName` helper function in [Layout API](https://www.adaptabletools.com/docs/technical-reference-layouts/index.md) which can fetch an Extended Layout from AdapTable State.

This is particularly useful if wanting to share or clone an Extended Layout (see below)

### `getExtendedLayoutByName`

Returns the full Extended Layout object with the given name

This function returns an Extended Layout with the provided name, or `undefined` if no Layout with that name exists.

The `Extensions` only include objects explicitly extended into the Layout - global objects are not included

```ts {3}
// Get the full Extended Layout for the Current Layout and output to console
const layoutApi: LayoutApi = adaptableApi.layoutApi;
const extendedLayout: ExtendedLayout = layoutApi.getExtendedLayoutByName(
  layoutApi.getCurrentLayoutName()
);
```

### Sharing Extended Layouts

By their nature, Extended Layouts are not stored as a single, composite object in [Adaptable State](https://www.adaptabletools.com/docs/dev-guide-adaptable-state/index.md).

Instead, the Layout is stored with other Layouts, the extended objects (e.g. Format Columns or Custom Sorts) are stored in the appropriate State section, and the association between them is stored in `LayoutExtensions`.

However by using the 2 functions above - `getExtendedLayoutByName` and `createOrUpdateExtendedLayout` - it is possible to fetch an Extended Layout, make any changes to it as needed, and save it elsewhere.

- A better way to do this is via [Referenced Team Sharing](https://www.adaptabletools.com/docs/handbook-team-sharing-referenced/index.md)
- This shares a Layout together with all the objects extended into it

**Example: Sharing Extended Layouts**

Sharing an Extended Layout

- This example has an initial Layout ('First Layout') extended with 4 Format Columns
- A Custom Dashboard Button imports - and sets - a new Extended Layout ('Imported Layout') with 2 Styled Columns
- When a Layout is Selected we send a System Status message with its contents (and log the full object to the console())

- Click the button to import and set the new Extended Layout and note that you see the Layout and the 2 Styled Columns (but not the 4 Format Columns)
- Open the System Status popup to see the contents of the Extended Layout
- Open the Console and switch between Layouts to see the full Extended Layout object

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 {
  AdaptableButton,
  AdaptableOptions,
  CustomToolbarButtonContext,
  ExtendedLayout,
  StyledColumn,
  TableLayout,
} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Sharing Extended Layouts',
  dashboardOptions: {
    customToolbars: [
      {
        name: 'ButtonToolbar',
        title: 'Buttons',
        toolbarButtons: [
          {
            label: 'Import (and Select) Extended Layout',
            onClick: (
              button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              // Define an Extended Layout with 2 Styled Columns and Import and select it
              const badgeStyle: StyledColumn = {
                ColumnId: 'name',
                Name: 'name Badge',
                BadgeStyle: {
                  Badges: [
                    {
                      PillStyle: {
                        BackColor: 'DarkGray',
                      },
                    },
                  ],
                },
              };
              const gradientStyle: StyledColumn = {
                ColumnId: 'open_pr_count',
                Name: 'open_pr_count Gradient',
                GradientStyle: {
                  CellRanges: [
                    {
                      Min: 0,
                      Max: 254,
                      Color: '#a52a2a',
                    },
                  ],
                },
              };

              const importedLayout: TableLayout = {
                Name: 'Imported Layout',
                TableColumns: [
                  'name',
                  'license',
                  'language',
                  'github_stars',
                  'open_pr_count',
                ],
              };

              const extendedLayout: ExtendedLayout = {
                Layout: importedLayout,
                Extensions: [
                  {
                    Module: 'StyledColumn',
                    Object: badgeStyle,
                  },
                  {
                    Module: 'StyledColumn',
                    Object: gradientStyle,
                  },
                ],
              };

              // Saves the Layout and both Styled Columns, and extends the Styled Columns into the Layout
              context.adaptableApi.layoutApi.createOrUpdateExtendedLayout(
                extendedLayout
              );
              context.adaptableApi.layoutApi.setLayout(importedLayout.Name);
            },
            buttonStyle: {
              tone: 'info',
              variant: 'text',
            },
          },
        ],
      },
    ],
  },
  initialState: {
    Dashboard: {
      ModuleButtons: [
        'Layout',
        'FormatColumn',
        'StyledColumn',
        'SystemStatus',
      ],
      Tabs: [
        {
          Name: 'Demo',
          Toolbars: ['ButtonToolbar', 'Layout', 'SystemStatus'],
        },
      ],
    },
    StatusBar: {
      StatusBars: [
        {
          Key: 'Center Panel',
          StatusBarPanels: ['Layout'],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'First Layout',
      Layouts: [
        {
          TableColumns: [
            'name',
            'license',
            'language',
            'github_stars',
            'open_pr_count',
            'closed_issues_count',
            'created_at',
            'updated_at',
            'pushed_at',
            'created_at',
            'has_wiki',
            'github_watchers',
            'description',
            'open_issues_count',
            'closed_pr_count',
            'has_projects',
            'has_pages',
            'week_issue_change',
          ],
          Name: 'First Layout',
          AutoSizeColumns: true,
        },
      ],
      LayoutExtensions: [
        {
          LayoutName: 'First Layout',
          FormatColumn: [
            'formatColumn-license',
            'formatColumn-date',
            'formatColumn-language',
            'formatColumn-all',
          ],
        },
      ],
    },
    FormatColumn: {
      FormatColumns: [
        {
          Name: 'formatColumn-license',
          Scope: {
            ColumnIds: ['license'],
          },
          Style: {
            FontWeight: 'Bold',
          },
        },
        {
          Name: 'formatColumn-date',
          Scope: {
            DataTypes: ['date'],
          },
          Style: {
            FontStyle: 'Italic',
            Alignment: 'Center',
          },
          DisplayFormat: {
            Formatter: 'DateFormatter',
            Options: {
              Pattern: 'MMM do yyyy',
            },
          },
        },
        {
          Name: 'formatColumn-language',
          Style: {
            BackColor: 'var(--ab-color-palette-25)',
          },
          Scope: {
            ColumnIds: ['language'],
          },
          Rule: '[language] = "TypeScript"',
        },
        {
          Name: 'formatColumn-all',
          Style: {
            BackColor: 'var(--ab-color-palette-32)',
          },
          Scope: {
            All: true,
          },
          Rule: '[language] = "HTML"',
        },
      ],
    },
  },
};
```

**`src/onAdaptableReady.ts`**

```ts
import {
  AdaptableReadyInfo,
  ExtendedLayout,
  LayoutApi,
  LayoutChangedAction,
} from '@adaptabletools/adaptable';

export const onAdaptableReady = async ({adaptableApi}: AdaptableReadyInfo) => {
  adaptableApi.eventApi.on('LayoutChanged', layoutChangedInfo => {
    const actionName: LayoutChangedAction = layoutChangedInfo.actionName;
    if (actionName == 'LAYOUT_SELECT' || actionName == 'LAYOUT_READY') {
      const layoutApi: LayoutApi = adaptableApi.layoutApi;
      const currentLayoutName: string = layoutApi.getCurrentLayoutName();
      const extendedLayout: ExtendedLayout | undefined =
        layoutApi.getExtendedLayoutByName(currentLayoutName);
      if (extendedLayout) {
        adaptableApi.systemStatusApi.setInfoSystemStatus(
          currentLayoutName,
          JSON.stringify(extendedLayout)
        );
        console.log(currentLayoutName, extendedLayout);
      }
    }
  });
};
```

### Cloning Extended Layouts

Extended Layouts, like regular Layouts, can be cloned.

AdapTable clones the underlying Layout and extends all of the original Layout's objects (e.g. Format Columns or Styled Columns) into the clone.

This is done using the `cloneExtendedLayout` function in [Layout API](https://www.adaptabletools.com/docs/technical-reference-layouts/index.md).

### `cloneExtendedLayout`

Clones an Extended Layout

This function returns an Extended Layout, with the given name, which clones the one provided. It returns `false` if the new name is already in use.

```ts {4}
// Retrieve the "Hello" Layout and clone it with the new name "Goodbye"
const layoutApi: LayoutApi = adaptableApi.layoutApi;
const layoutToExtend: ExtendedLayout =
  layoutApi.getExtendedLayoutByName('Hello');
const extendedLayout: ExtendedLayout = layoutApi.cloneExtendedLayout(
  layoutToExtend,
  'Goodbye'
);
```

- The extended objects themselves are not copied - both original and cloned Layouts reference the same objects
- This means that changing that object (e.g. a Format Column) will be reflected in both Layouts

**Example: Cloning Extended Layouts**

Cloning an Extended Layout

- This example has an Extended Layout ('Original Layout') which we clone

1. Click first the button to clone (and then set) the Extended Layout and note that all extended objects apply in the clone
2. Click the second button (which becomes enabled) to change the style for the `Language` Column
3. Switch Layouts and note that you see the new style in the original Layout also

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 {
  AdaptableButton,
  AdaptableOptions,
  AdaptableStyle,
  CustomToolbarButtonContext,
  ExtendedLayout,
  FormatColumn,
  FormatColumnApi,
  LayoutApi,
} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Cloning Extended Layouts',
  dashboardOptions: {
    customToolbars: [
      {
        name: 'ButtonToolbar',
        title: 'Buttons',
        toolbarButtons: [
          {
            label: 'Clone Extended Layout',
            onClick: (
              button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              const layoutApi: LayoutApi = context.adaptableApi.layoutApi;
              const layoutToExtend: ExtendedLayout | undefined =
                layoutApi.getExtendedLayoutByName('Original Layout');
              if (layoutToExtend) {
                const clonedLayout: ExtendedLayout | false =
                  layoutApi.cloneExtendedLayout(
                    layoutToExtend,
                    'Cloned Layout'
                  );
                if (clonedLayout !== false) {
                  context.adaptableApi.layoutApi.setLayout(
                    clonedLayout.Layout.Name
                  );
                }
              }
            },
            buttonStyle: {
              tone: 'info',
              variant: 'text',
            },
          },
          {
            label: 'Change Language Style',
            onClick: (
              button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              const formatColumnApi: FormatColumnApi =
                context.adaptableApi.formatColumnApi;
              const formatColumn: FormatColumn =
                formatColumnApi.getFormatColumnsForColumnId('language')[0];
              if (formatColumn) {
                const style: AdaptableStyle | undefined = {
                  BackColor: 'var(--ab-color-palette-19)',
                };
                formatColumn.Style = style;
                formatColumnApi.editFormatColumn(formatColumn);
              }
            },
            buttonStyle: {
              tone: 'success',
              variant: 'text',
            },
            disabled: (
              button: AdaptableButton<CustomToolbarButtonContext>,
              context: CustomToolbarButtonContext
            ) => {
              return context.adaptableApi.layoutApi.getLayouts().length == 1;
            },
          },
        ],
      },
    ],
  },
  layoutOptions: {
    enableLayoutExtensionsUI: true,
  },
  initialState: {
    Dashboard: {
      Tabs: [
        {
          Name: 'Demo',
          Toolbars: ['ButtonToolbar', 'Layout'],
        },
      ],
    },
    StatusBar: {
      StatusBars: [
        {
          Key: 'Center Panel',
          StatusBarPanels: ['Layout'],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Original Layout',
      Layouts: [
        {
          TableColumns: [
            'name',
            'license',
            'language',
            'github_stars',
            'open_pr_count',
            'closed_issues_count',
            'created_at',
            'updated_at',
            'pushed_at',
            'created_at',
            'has_wiki',
            'github_watchers',
            'description',
            'open_issues_count',
            'closed_pr_count',
            'has_projects',
            'has_pages',
            'week_issue_change',
          ],
          Name: 'Original Layout',
          AutoSizeColumns: true,
        },
      ],
      LayoutExtensions: [
        {
          LayoutName: 'Original Layout',
          FormatColumn: [
            'formatColumn-license',
            'formatColumn-date',
            'formatColumn-language',
            'formatColumn-all',
          ],
        },
      ],
    },
    FormatColumn: {
      FormatColumns: [
        {
          Name: 'formatColumn-license',
          Scope: {
            ColumnIds: ['license'],
          },
          Style: {
            FontWeight: 'Bold',
          },
        },
        {
          Name: 'formatColumn-date',
          Scope: {
            DataTypes: ['date'],
          },
          Style: {
            FontStyle: 'Italic',
            Alignment: 'Center',
          },
          DisplayFormat: {
            Formatter: 'DateFormatter',
            Options: {
              Pattern: 'MMM do yyyy',
            },
          },
        },
        {
          Name: 'formatColumn-language',
          Style: {
            BackColor: 'var(--ab-color-palette-25)',
          },
          Scope: {
            ColumnIds: ['language'],
          },
          Rule: '[language] = "TypeScript"',
        },
        {
          Name: 'formatColumn-all',
          Style: {
            BackColor: 'var(--ab-color-palette-32)',
          },
          Scope: {
            All: true,
          },
          Rule: '[language] = "HTML"',
        },
      ],
    },
  },
};
```

## Metadata

Sometimes developers want to extend Layouts by including their own custom bespoke properties and objects.

A common use case is to include the Author or the Team or other organisation-specific details

This is done by using the `Metadata` property (of type `any`) which is in the [Adaptable Object](https://www.adaptabletools.com/docs/dev-guide-adaptable-state-initial-state/index.md#adaptable-objects) type, from which the Layout object derives.

Unlike most properties in the Layout, `Metadata` can only be added at design-time or programmatically

**Example: Layouts With Metadata**

Adding Metadata to Layouts

- This example shows how to use Layout Metadata. We add a `Metadata` property to 4 layouts:
  - `First Layout` and `Third Layout` - have `Metadata` property of 'Large' - and they show the Dashboard, open the Tool Panel and use dark theme
  - `Second Layout` and `Fourth Layout` - have `Metadata` property of 'Small' - and they hide the Dashboard, close the Tool Panel and use light theme

- Switch between the Layouts (you might need to use the status bar when the Dashboard is hidden!) to see how we listen to Metadata and change the grid accordingly

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: 'Layout Meta Data',
  initialState: {
    Dashboard: {
      ModuleButtons: ['Layout'],
      PinnedToolbars: ['Layout'],
    },
    StatusBar: {
      StatusBars: [
        {
          Key: 'Center Panel',
          StatusBarPanels: ['Layout'],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'First Layout',
      Layouts: [
        {
          TableColumns: [
            'name',
            'license',
            'language',
            'github_stars',
            'open_pr_count',
            'closed_issues_count',
            'created_at',
            'updated_at',
            'pushed_at',
            'has_wiki',
            'github_watchers',
            'description',
            'open_issues_count',
            'closed_pr_count',
            'has_projects',
            'has_pages',
            'week_issue_change',
          ],
          Name: 'First Layout',
          AutoSizeColumns: true,
          Metadata: 'Large',
        },
        {
          TableColumns: [
            'name',
            'language',
            'github_stars',
            'open_pr_count',
            'closed_issues_count',
            'created_at',
            'updated_at',
            'pushed_at',
            'license',
            'has_wiki',
            'github_watchers',
            'description',
            'open_issues_count',
            'closed_pr_count',
            'has_projects',
            'has_pages',
            'week_issue_change',
          ],
          Name: 'Second Layout',
          RowGroupedColumns: ['language'],
          AutoSizeColumns: true,
          Metadata: 'Small',
        },
        {
          Name: 'Third Layout',
          PivotColumns: ['license'],
          PivotGroupedColumns: ['language'],
          PivotAggregationColumns: [
            {
              ColumnId: 'github_watchers',
              AggFunc: 'count',
            },
            {
              ColumnId: 'github_stars',
              AggFunc: 'sum',
            },
          ],
          Metadata: 'Large',
        },
        {
          Name: 'Fourth Layout',
          PivotColumns: [],
          PivotGroupedColumns: ['license'],
          SuppressAggFuncInHeader: true,
          PivotAggregationColumns: [
            {
              ColumnId: 'github_watchers',
              AggFunc: 'sum',
            },
            {
              ColumnId: 'github_stars',
              AggFunc: 'sum',
            },
            {
              ColumnId: 'Total',
              AggFunc: 'sum',
            },
          ],
          Metadata: 'Small',
        },
      ],
    },
  },
};
```

**`src/onAdaptableReady.ts`**

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

export const onAdaptableReady = (info: AdaptableReadyInfo) => {
  const adaptableApi = info.adaptableApi;

  function updateGrid(adaptableApi: AdaptableApi): void {
    const currentLayout = adaptableApi.layoutApi.getCurrentLayout();
    console.log('Metadata', currentLayout.Metadata);
    console.log('Metadata2', currentLayout.Metadata?.toString());
    if (currentLayout.Metadata?.toLocaleString().includes('Small')) {
      adaptableApi.dashboardApi.hideDashboard();
      adaptableApi.toolPanelApi.closeAdapTableToolPanel();
      adaptableApi.themeApi.loadLightTheme();
      adaptableApi.filterApi.columnFilterApi.hideQuickFilterBar();
    } else if (currentLayout.Metadata?.toLocaleString().includes('Large')) {
      adaptableApi.dashboardApi.showDashboard();
      adaptableApi.toolPanelApi.openAdapTableToolPanel();
      adaptableApi.themeApi.loadDarkTheme();
      adaptableApi.filterApi.columnFilterApi.showQuickFilterBar();
    }
  }

  updateGrid(adaptableApi);

  adaptableApi.eventApi.on(
    'LayoutChanged',
    (layoutChangedInfo: LayoutChangedInfo) => {
      console.log('info', layoutChangedInfo);
      if (layoutChangedInfo.actionName === 'LAYOUT_SELECT') {
        updateGrid(adaptableApi);
      }
    }
  );
};
```
