These are the docs for the Metabase master branch. Some features documented here may not yet be available in the current release. Check out the docs for the current stable version, Metabase v0.58.

Modular embedding components

There are different components you can embed, each with various options.

While you can use component parameters to show or hide parts of the embedded component, these parameters are not a substitute for permissions. Even if you hide stuff, people could still grab their token from the frontend and use it to query the Metabase API.

This page covers what you can embed. For theming your embeds, see Appearance.

Depending on the framework you’re using, you may need to stringify attributes before passing them to the embedded components.

Dashboard

To render a dashboard:

<metabase-dashboard dashboard-id="1" with-title="true" with-downloads="false">
</metabase-dashboard>

Attributes

Property Type Description
auto-refresh-interval number Auto-refresh interval in seconds. For example, 60 refreshes the dashboard every 60 seconds.

Optional
Available in Pro/Enterprise and Guest embed.
dashboard-id string | number The ID of the dashboard to embed. Can be a regular ID or an entity ID. Only for SSO embeds — guest embeds set the ID with token.
drills boolean Whether to enable drill-through on the dashboard.

Optional
Default: true
Available in Pro/Enterprise.
enable-entity-navigation boolean Whether to enable internal entity navigation (links to dashboards/questions). Requires drills to be true

Optional
Default: false
Available in Pro/Enterprise.
hidden-parameters string[] List of filter names to hide from the dashboard, e.g. ['productId'].

Optional
Available in Pro/Enterprise.
initial-parameters object Default values for dashboard filters, e.g. { 'productId': '42' }.

Optional
Available in Pro/Enterprise and Guest embed.
token string The token for guest embeds. Set automatically by the guest embed flow.

Optional
Available in Guest embed.
with-downloads boolean Whether to show the button to download the dashboard as PDF and download question results.

Optional
Default: true on OSS/Starter, false on Pro/Enterprise
Available in Guest embed.
with-subscriptions boolean Whether to let people set up dashboard subscriptions. Subscriptions sent from embedded dashboards exclude links to Metabase items.

Optional
Available in Pro/Enterprise.
with-title boolean Whether to show the dashboard title in the embed.

Optional
Default: true
Available in Guest embed.

For all modular embeds, you can also set a locale in your page-level configuration to translate embedded content, including content from translation dictionaries.

If you surround your attribute value with double quotes, make sure to use single quotes:

<metabase-dashboard
  dashboard-id="1"
  initial-parameters="{ 'productId': '42' }"
></metabase-dashboard>

If you surround your attribute value with double quotes, make sure to use single quotes:

<metabase-dashboard
  dashboard-id="1"
  hidden-parameters="['productId']"
></metabase-dashboard>

Resizing dashboards to fit their content

The <metabase-dashboard> web component automatically resizes to fit its content. No additional configuration is needed.

Question

To render a question (chart):

<metabase-question question-id="1"></metabase-question>

You can also use the question component to create new questions:

  • question-id="new" — opens the visual query builder.
  • question-id="new-native" — opens the SQL editor.

For example, to embed the SQL editor:

<metabase-question question-id="new-native"></metabase-question>

Attributes

Property Type Description
drills boolean Whether to enable drill-through on the question.

Optional
Default: true
Available in Pro/Enterprise.
entity-types string[] Which entity types to show in the question’s data picker, e.g. ["model", "table"].

Optional
Possible values: "model", "table"
Available in Pro/Enterprise and Guest embed.
hidden-parameters string[] List of parameter names to hide from the question.

Optional
Available in Pro/Enterprise.
initial-sql-parameters object Default values for SQL parameters, only applicable to native SQL questions, e.g. { "productId": "42" }.

Optional
Available in Pro/Enterprise and Guest embed.
is-save-enabled boolean Whether the save button is enabled.

Optional
Default: false
Available in Pro/Enterprise.
question-id string | number The ID of the question to embed. Can be a regular ID or an entity ID. Use "new" to embed the query builder. Only for SSO embeds — guest embeds use token.
target-collection string | number The collection to save a question to. Values: regular ID, entity ID, "personal", "root".

Optional
Available in Pro/Enterprise.
token string The token for guest embeds. Set automatically by the guest embed flow.

Optional
Available in Guest embed.
with-alerts boolean Whether to show the alerts button.

Optional
Default: false
Available in Pro/Enterprise.
with-downloads boolean Whether to show download buttons for question results.

Optional
Default: true on OSS/Starter, false on Pro/Enterprise
Available in Guest embed.
with-title boolean Whether to show the question title in the embed.

Optional
Default: true
Available in Guest embed.

Browser

Browser component is only available on Pro and Enterprise plans (both self-hosted and on Metabase Cloud).

Browser component is only available for authenticated modular embeds. It’s unavailable for Guest embeds.

To render a collection browser so people can navigate a collection and open dashboards or questions:

<metabase-browser
  initial-collection="14"
  read-only="false"
  collection-entity-types="['collection', 'dashboard']"
>
</metabase-browser>

Attributes

Property Type Description
collection-entity-types string[] An array of entity types to show in the collection browser: collection, dashboard, question, model.

Optional
Possible values: "model", "collection", "dashboard", "question"
collection-page-size number How many items to show per page in the collection browser.

Optional
collection-visible-columns string[] An array of columns to show in the collection browser: type, name, description, lastEditedBy, lastEditedAt, archive.

Optional
Possible values: "type", "name", "description", "lastEditedBy", "lastEditedAt", "archive"
data-picker-entity-types string[] An array of entity types to show in the question’s data picker: model, table.

Optional
Possible values: "model", "table"
enable-entity-navigation boolean Whether to enable internal entity navigation (links to dashboards/questions).

Optional
Default: false
initial-collection string | number Which collection to start from. Use a collection ID (e.g., 14) to start in a specific collection, or "root" for the top-level “Our Analytics” collection.
read-only boolean Whether the content manager is in read-only mode. When true, people can interact with items (filter, summarize, drill-through) but can’t save. When false, they can create and edit items.

Optional
Default: true
with-new-dashboard boolean Whether to show the “New dashboard” button. Only applies when read-only is false.

Optional
Default: true
with-new-question boolean Whether to show the “New exploration” button.

Optional
Default: true

AI chat

AI chat component is only available on Pro and Enterprise plans (both self-hosted and on Metabase Cloud).

AI chat component is only available for authenticated modular embeds. It’s unavailable for Guest embeds.

To render the AI chat interface:

<metabase-metabot></metabase-metabot>

Attributes

Property Type Description
is-save-enabled boolean Whether the save button is enabled.

Optional
Default: false
layout string How should the browser position the visualization with respect to the chat interface. auto uses stacked on mobile and sidebar on larger screens.

Optional
Default: "auto"
Possible values: "auto", "sidebar", "stacked"
target-collection string | number The collection to save a question to.

Optional

Customizing loader and error components

Customizing loader and error componentst is only available on Pro and Enterprise plans (both self-hosted and on Metabase Cloud).

If you’re using the modular embedding SDK, you can provide your own components for loading and error states by specifying loaderComponent and errorComponent as props to MetabaseProvider.

import {
  MetabaseProvider,
  StaticDashboard,
} from "@metabase/embedding-sdk-react";

<MetabaseProvider
  loaderComponent={() => <div>Analytics is loading...</div>}
  errorComponent={({ type, message, onClose }) => {
    switch (type) {
      case "fixed":
        return (
          <div style={{ position: "fixed", left: 0, right: 0, bottom: 0 }}>
            There was an error: {message}. <span onClick={onClose}>X</span>
          </div>
        );
      case "relative":
      default:
        return <div>There was an error: {message}</div>;
    }
  }}
>
  <StaticDashboard dashboardId={1} />
</MetabaseProvider>

Further reading

Read docs for other versions of Metabase.

Was this helpful?

Thanks for your feedback!
Want to improve these docs? Propose a change.