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

Question

Browser

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

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>

If you’re using the SDK, you can use either the MetabotQuestion component or the useMetabot hook for a custom UI.

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 components 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.