---
title: "Custom visualizations in embeds"
description: "Enable custom visualizations in your embeds by adding them to your allowlist."
url: "https://www.metabase.com/docs/latest/embedding/custom-visualizations"
version: "65"
---

> For the complete documentation index, see [llms.txt](https://www.metabase.com/docs/llms.txt).

# Custom visualizations in embeds

> Custom visualizations is only available on [Pro](https://www.metabase.com/product/pro) and [Enterprise](https://www.metabase.com/product/enterprise) plans (both self-hosted and on Metabase Cloud).

Authenticated [modular embeds](https://www.metabase.com/docs/latest/embedding/modular-embedding.md) can render [custom visualizations](https://www.metabase.com/docs/latest/questions/visualizations/custom.md), whether you're embedding with web components or with the [React SDK](https://www.metabase.com/docs/latest/embedding/sdk/introduction.md).

- [An admin has to turn on custom visualizations first](#an-admin-has-to-turn-on-custom-visualizations-first)
- [Add custom visualizations to your allowlist](#add-custom-visualizations-to-your-allowlist)
- [Set a Content Security Policy in your app](#set-a-content-security-policy-in-your-app)
- [Custom visualizations don't work in guest embeds](#custom-visualizations-dont-work-in-guest-embeds)

## An admin has to turn on custom visualizations first

Before an embed can render a custom visualization, an admin needs to [turn on custom visualizations](https://www.metabase.com/docs/latest/questions/visualizations/custom.md#enabling-custom-visualizations) in your Metabase and upload the visualization. If the visualization doesn't exist in your Metabase, allowlisting its name in your app won't do anything.

To build a custom visualization, check out [Building custom visualizations](https://www.metabase.com/docs/latest/developers-guide/custom-visualizations.md).

## Add custom visualizations to your allowlist

Embeds don't load custom visualizations by default. You have to list each visualization you want in the `allowedCustomVisualizations` allowlist. Any question that uses a custom visualization that isn't on the allowlist will fall back to the default visualization for that query's results.

Each entry in the allowlist is the custom visualization's name, prefixed with `custom:`. A custom visualization named `Calendar Heatmap` becomes `"custom:Calendar Heatmap"`. The name comes from the `name` in the visualization's plugin manifest. You can look it up in your Metabase under **Admin** > **Settings** > **Custom visualizations** > **Manage visualizations**.

Names are case-sensitive, so `"custom:calendar heatmap"` won't match a visualization named `Calendar Heatmap`. If an entry on your allowlist doesn't match an uploaded visualization, Metabase logs a warning to the browser console.

Where the allowlist goes depends on how you're embedding:

- [Web components](#web-components-allowlist-for-custom-visualizations)
- [React SDK](#react-sdk-allowlist-for-custom-visualizations)

### Web components allowlist for custom visualizations

`allowedCustomVisualizations` is a [page-level config](https://www.metabase.com/docs/latest/embedding/config.md#configure-web-components), not an attribute on `<metabase-dashboard>` or `<metabase-question>`. The allowlist applies to every component on the page.

Add `allowedCustomVisualizations` to `defineMetabaseConfig()`:

```html
<!-- Load embedding library -->
<!-- REPLACE WITH YOUR METABASE URL HERE -->
<script defer src="https://your-metabase-url/app/embed.js"></script>

<!-- Embedding configuration -->
<script>
  function defineMetabaseConfig(config) {
    window.metabaseConfig = config;
  }
</script>

<script>
  defineMetabaseConfig({
    instanceUrl: "https://your-metabase-url",
    allowedCustomVisualizations: ["custom:Calendar Heatmap", "custom:Thumbs"],
  });
</script>

<metabase-dashboard dashboard-id="1"></metabase-dashboard>
```

These examples use sequential IDs — the number in the item's URL. On Pro and Enterprise plans, you can use [entity IDs](https://www.metabase.com/docs/latest/installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; they stay the same when you [serialize](https://www.metabase.com/docs/latest/installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production.

If you create your embed through the [embed wizard](https://www.metabase.com/docs/latest/embedding/modular-embedding.md#create-a-new-embed), Metabase fills in the allowlist with the custom visualizations that the dashboard or question you picked already uses, so the generated snippet works as-is.

### React SDK allowlist for custom visualizations

Pass the `allowedCustomVisualizations` prop to `MetabaseProvider`. Like the page-level config for web components, the allowlist is global: it applies to every embedded component under the provider, not to one question or dashboard.

```typescript
<MetabaseProvider
  authConfig={authConfig}
  // Allowlist the custom visualizations to load, by their names,
  // each prefixed with `custom:`.
  allowedCustomVisualizations={["custom:Calendar Heatmap", "custom:Thumbs"]}
>
  {children}
</MetabaseProvider>
```

## Set a Content Security Policy in your app

A custom visualization runs third-party JavaScript in your app. Metabase runs that code in an isolated sandbox, so a visualization can't reach the rest of your app or make network requests. The sandbox doesn't block passive image loads, though: a visualization can still trigger outbound requests through `<img>` tags or CSS `url()`.

To limit where custom visualizations can load images from, set a [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP) with an `img-src` allowlist in your app. The core Metabase app sets this CSP with [Restrict image domains](https://www.metabase.com/docs/latest/configuring-metabase/domains.md#restrict-where-images-can-load-from), but you should also set a CSP in your app.

## Custom visualizations don't work in guest embeds

Custom visualizations only work when Metabase knows who's viewing the embed. [Guest embeds](https://www.metabase.com/docs/latest/embedding/guest-embedding.md) ignore `allowedCustomVisualizations` (and log a warning to the console), and fall back to the default visualization.

Any embed with a signed-in person can load custom visualizations, including embeds you're previewing locally with an API key or your existing Metabase session. See [Authentication](https://www.metabase.com/docs/latest/embedding/authentication.md).

### Public links, subscriptions, and alerts fall back to the default visualization

Nobody signs in to view a [public link](https://www.metabase.com/docs/latest/embedding/public-links.md), and nobody's signed in when Metabase renders a [dashboard subscription or alert](https://www.metabase.com/docs/latest/questions/alerts.md), so a question that uses a custom visualization falls back to the default visualization for its results in both cases.

## Further reading

- [Custom visualizations](https://www.metabase.com/docs/latest/questions/visualizations/custom.md)
- [Building custom visualizations](https://www.metabase.com/docs/latest/developers-guide/custom-visualizations.md)
- [Modular embedding](https://www.metabase.com/docs/latest/embedding/modular-embedding.md)
- [Modular embedding components](https://www.metabase.com/docs/latest/embedding/components.md)
