***

title: "DefineDashboardExtension"
generated: true
---------------

## defineDashboardExtension

<GenerationInfo sourceFile="packages/dashboard/src/lib/framework/extension-api/define-dashboard-extension.ts" sourceLine="114" packageName="@vendure/dashboard" since="3.3.0" />

The main entry point for extensions to the React-based dashboard. Every dashboard extension
must contain a call to this function, usually in the entry point file that is referenced by
the `dashboard` property of the plugin decorator.

Every type of customisation of the dashboard can be defined here, including:

* Navigation (nav sections and routes)
* Layout (action bar items and page blocks)
* Widgets
* Form input components for custom fields, configurable operation arguments, and native detail-page fields
* Data tables
* Detail forms
* Login
* Custom history entries
* Toolbar items
* Refund destinations

*Example*

```tsx
defineDashboardExtension({
    navSections: [],
    routes: [],
    pageBlocks: [],
    actionBarItems: [],
    alerts: [],
    widgets: [],
    customFormComponents: {},
    dataTables: [],
    detailForms: [],
    login: {},
    historyEntries: [],
    toolbarItems: [],
    refundDestinations: [],
});
```

```ts title="Signature"
function defineDashboardExtension(extension: DashboardExtension): void
```

Parameters

### extension

\<MemberInfo kind="parameter" type={`<a href='/current/framework/reference/dashboard/extensions-api/define-dashboard-extension#dashboardextension'>DashboardExtension</a>`} />

## DashboardExtension

<GenerationInfo sourceFile="packages/dashboard/src/lib/framework/extension-api/extension-api-types.ts" sourceLine="43" packageName="@vendure/dashboard" since="3.3.0" />

This is the main interface for defining *all* extensions to the dashboard.

Every type of customisation of the dashboard can be defined here, including:

* Navigation (nav sections and routes)
* Layout (action bar items and page blocks)
* Widgets for the Insights page
* Form input components for custom fields, configurable operation arguments, and native detail-page fields
* Data tables
* Detail forms
* Login page customisation
* Alerts
* History entries
* Toolbar items

```ts title="Signature"
interface DashboardExtension {
    routes?: DashboardRouteDefinition[];
    navSections?: DashboardNavSectionDefinition[] | ((config: NavMenuConfig) => NavMenuConfig);
    pageBlocks?: DashboardPageBlockDefinition[];
    actionBarItems?: DashboardActionBarItem[];
    alerts?: DashboardAlertDefinition[];
    widgets?: DashboardWidgetDefinition[];
    insights?: DashboardInsightsExtensionDefinition;
    customFormComponents?: DashboardCustomFormComponents;
    dataTables?: DashboardDataTableExtensionDefinition[];
    detailForms?: DashboardDetailFormExtensionDefinition[];
    login?: DashboardLoginExtensions;
    historyEntries?: DashboardHistoryEntryComponent[];
    refundDestinations?: DashboardRefundDestinationDefinition[];
    toolbarItems?: DashboardToolbarItemDefinition[];
    customProviders?: DashboardCustomProviderDefinition[];
}
```

<div className="members-wrapper">

### routes

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/routes#dashboardroutedefinition'>DashboardRouteDefinition</a>[]`}   />

Allows you to define custom routes such as list or detail views.

### navSections

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/navigation#dashboardnavsectiondefinition'>DashboardNavSectionDefinition</a>[] | ((config: NavMenuConfig) => NavMenuConfig)`}   />

Allows you to define custom nav sections for the dashboard.

Can be provided as either:

* An **array** of `DashboardNavSectionDefinition` objects to declaratively add new sections
* A **function** that receives the current `NavMenuConfig` and returns a new one, allowing
  full control over the nav menu (move, remove, reorder items between sections)

When using the function form, the function is guaranteed to run *after* all array-form
registrations have completed, so it always sees the fully-populated nav config.

*Example*

```ts
// Array form (existing)
navSections: [{ id: 'my-section', title: 'My Section' }]

// Function form (new)
navSections: (config) => ({
    sections: config.sections.map(s =>
        s.id === 'settings' && 'items' in s
            ? { ...s, items: s.items?.filter(i => i.id !== 'administrators') }
            : s
    ),
})

// Function form, deciding per user. The function itself still runs once, at
// registration; the predicate it attaches is evaluated on every nav render.
navSections: config =>
    setNavVisibility(config, { sections: [BUILT_IN_NAV_SECTION_IDS.Catalog] }, ctx => !isFloorStaff(ctx)),
```

Note: modifier functions should return a **new** config object rather than
mutating the input, to ensure predictable behavior when multiple modifiers
are composed. The function form was introduced in version 3.6.0.

### pageBlocks

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/page-blocks#dashboardpageblockdefinition'>DashboardPageBlockDefinition</a>[]`}   />

Allows you to define custom page blocks for any page in the dashboard.

### actionBarItems

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/action-bar#dashboardactionbaritem'>DashboardActionBarItem</a>[]`}   />

Allows you to define custom action bar items for any page in the dashboard.

### alerts

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/alerts#dashboardalertdefinition'>DashboardAlertDefinition</a>[]`}   />

Allows you to define custom alerts that can be displayed in the dashboard.

### widgets

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/widgets#dashboardwidgetdefinition'>DashboardWidgetDefinition</a>[]`}   />

Allows you to define custom widgets for the Insights page.

### insights

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/define-dashboard-extension#dashboardinsightsextensiondefinition'>DashboardInsightsExtensionDefinition</a>`}  since="3.8.0"  />

Groups all Insights page extension options, such as custom widgets and
code-level widget exclusions.

*Example*

```ts
defineDashboardExtension({
    insights: {
        widgets: [myWidget],
        excludeWidgets: ['latest-orders-widget'],
    },
});
```

### customFormComponents

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/form-components#dashboardcustomformcomponents'>DashboardCustomFormComponents</a>`}   />

Registers custom input component IDs for custom fields and configurable operation arguments.

### dataTables

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/data-tables#dashboarddatatableextensiondefinition'>DashboardDataTableExtensionDefinition</a>[]`}   />

Allows you to customize aspects of existing data tables in the dashboard.

### detailForms

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/detail-forms#dashboarddetailformextensiondefinition'>DashboardDetailFormExtensionDefinition</a>[]`}   />

Allows you to customize detail pages, including native field input overrides.

### login

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/login#dashboardloginextensions'>DashboardLoginExtensions</a>`}   />

Allows you to customize the login page with custom components.

### historyEntries

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/history-entries#dashboardhistoryentrycomponent'>DashboardHistoryEntryComponent</a>[]`}   />

Allows a custom component to be used to render a history entry item
in the Order or Customer history lists.

### refundDestinations

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/refund-destinations#dashboardrefunddestinationdefinition'>DashboardRefundDestinationDefinition</a>[]`}  since="3.8.0"  />

Allows the presentation of a refund destination to be customised in the refund dialog,
adding a label, an icon and an optional configuration component. The destination itself is
defined on the backend by a `RefundDestinationStrategy`.

### toolbarItems

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/toolbar#dashboardtoolbaritemdefinition'>DashboardToolbarItemDefinition</a>[]`}  since="3.5.3"  />

Allows you to define custom toolbar items in the app shell header bar.
Toolbar items appear alongside the breadcrumbs, Dev Mode indicator,
and alerts icon.

### customProviders

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/custom-providers#dashboardcustomproviderdefinition'>DashboardCustomProviderDefinition</a>[]`}  since="3.7.0"  />

Allows you to add custom providers in different locations.

</div>
## DashboardInsightsExtensionDefinition

<GenerationInfo sourceFile="packages/dashboard/src/lib/framework/extension-api/types/insights.ts" sourceLine="71" packageName="@vendure/dashboard" since="3.8.0" />

Configuration for the Insights page, grouping all insights-related extension
options such as widgets, code-level widget exclusions and global filters.

```ts title="Signature"
interface DashboardInsightsExtensionDefinition {
    widgets?: DashboardWidgetDefinition[];
    excludeWidgets?: string[];
    filters?: DashboardWidgetFilterDefinition[];
}
```

<div className="members-wrapper">

### widgets

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/widgets#dashboardwidgetdefinition'>DashboardWidgetDefinition</a>[]`}   />

Custom widgets to add to the Insights page.

### excludeWidgets

\<MemberInfo kind="property" type={`string[]`}   />

The ids of widgets that should be completely removed from the Insights page.
Excluded widgets are never rendered, never appear in the user-facing widget
picker, and cannot be re-enabled by a user setting. This works for both
built-in widgets and widgets registered by other extensions, regardless of
registration order.

*Example*

```ts
defineDashboardExtension({
    insights: {
        excludeWidgets: ['latest-orders-widget'],
    },
});
```

### filters

\<MemberInfo kind="property" type={`<a href='/current/framework/reference/dashboard/extensions-api/insights-filters#dashboardwidgetfilterdefinition'>DashboardWidgetFilterDefinition</a>[]`}  since="3.8.0"  />

Global filters whose components render in the Insights page action bar, next to
the built-in date range picker. A filter's value is shared with every widget on
the page, which reads it via `useWidgetFilters().filters[id]`. This lets several
widgets filter on a common constraint (for example a selected warehouse). Filter
state is session-only.

*Example*

```tsx
defineDashboardExtension({
    insights: {
        filters: [
            {
                id: 'warehouse',
                defaultValue: 'all',
                component: WarehouseFilter,
            },
        ],
    },
});
```

</div>
