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: trueAvailable in Pro/Enterprise. |
enable-entity-navigation |
boolean |
Whether to enable internal entity navigation (links to dashboards/questions). Requires drills to be true— Optional Default: falseAvailable 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/EnterpriseAvailable 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: trueAvailable 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: trueAvailable 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: falseAvailable 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: falseAvailable in Pro/Enterprise. |
with-downloads |
boolean |
Whether to show download buttons for question results. — Optional Default: true on OSS/Starter, false on Pro/EnterpriseAvailable in Guest embed. |
with-title |
boolean |
Whether to show the question title in the embed. — Optional Default: trueAvailable 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
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
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.