Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

docs - embedding dashboards (#79915)

Jeff Bruemmer93d7163cd281
diff --git a/docs/embedding/browser-reference.md b/docs/embedding/browser-reference.md
new file mode 100644
index 00000000000..e93a33966c7
--- /dev/null
+++ b/docs/embedding/browser-reference.md
@@ -0,0 +1,49 @@
+---
+title: Browser component reference
+summary: "Reference for the metabase-browser web component attributes and the CollectionBrowser SDK props."
+---
+
+# Browser component reference
+
+Reference material for embedding a collection browser:
+
+- [Web component attributes](#web-component-metabase-browser-attributes)
+- [React SDK props](#react-sdk-collectionbrowser-props)
+
+For how to set all this up, check out [Embed a collection browser](./browser.md).
+
+## Web component `metabase-browser` attributes
+
+These attributes apply to the `<metabase-browser>` web component.
+
+{% include_file "{{ dirname }}/eajs/snippets/MetabaseBrowserAttributes.md" snippet="properties" %}
+
+Depending on the framework you're using, you may need to stringify attributes before passing them to the component. And if you surround an attribute's value with double quotes, use single quotes inside it:
+
+```html
+<metabase-browser
+ initial-collection="123"
+ collection-entity-types="['collection', 'dashboard']"
+ data-picker-entity-types="['model']"
+></metabase-browser>
+```
+
+These examples use sequential IDs — the number in the item's URL. On Pro and Enterprise plans, you can use [entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; they stay the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production.
+
+## React SDK `CollectionBrowser` props
+
+{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
+
+`CollectionBrowser` lists the items in a collection and reports clicks. Unlike the web component, it doesn't open items or offer buttons for creating them. See [React SDK collection browser](./browser.md#react-sdk-collection-browser).
+
+- [Component](./sdk/api/CollectionBrowser.html)
+- [Props](./sdk/api/CollectionBrowserProps.html)
+
+{% include_file "{{ dirname }}/sdk/api/snippets/CollectionBrowserProps.md" snippet="properties" %}
+
+## Further reading
+
+- [Embed a collection browser](./browser.md)
+- [Dashboard component reference](./dashboard-reference.md)
+- [Question component reference](./question-reference.md)
+- [Modular embedding components](./components.md)
diff --git a/docs/embedding/browser.md b/docs/embedding/browser.md
new file mode 100644
index 00000000000..904cb888ea0
--- /dev/null
+++ b/docs/embedding/browser.md
@@ -0,0 +1,144 @@
+---
+title: Embed a collection browser
+summary: "Embed a browsable collection so people can find and open dashboards and questions from your app, with a web component or using the React SDK."
+redirect_from:
+ - /docs/latest/embedding/sdk/collections
+---
+
+# Embed a collection browser
+
+{% include plans-blockquote.html feature="Browser component" convert_pro_link_to_embedding=true%}
+
+![Collection browser embedded with the metabase-browser web component](./images/embedded-collection-browser.png)
+
+The collection browser lets people navigate through collections they have permission to view.
+
+There are two ways to embed a collection browser:
+
+- **[Web component](#web-component-collection-browser)**: a whole browser. Clicking an item opens it inside the embed, with breadcrumbs, create buttons, and [saving](#let-people-save-changes) already built.
+- **[React SDK](#react-sdk-collection-browser)**: a list of items with breadcrumbs, plus a click handler. Nothing opens on its own, so you decide what a click does and build any create or save flow in your own app.
+
+To see a collection browser, people need Metabase accounts, because Metabase uses [collection permissions](../permissions/collections.md) to work out what each person can see. So a collection browser only works in an [embed that signs people in with SSO](./introduction.md#components-with-sso-authentication); it won't work in a [guest embed](./guest-embedding.md).
+
+## Web component collection browser
+
+Point `<metabase-browser>` at the collection you want people to start in:
+
+```html
+<metabase-browser initial-collection="123"></metabase-browser>
+```
+
+`initial-collection` is the only required attribute. It takes:
+
+- A collection ID, like `123` — the number in the collection's URL. On Pro and Enterprise plans, you can use the collection's [entity ID](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead, which stays the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another.
+- `"root"` for the top-level **Our analytics** collection.
+- `"personal"` for the personal collection of whoever's viewing.
+- `"tenant"` for the [tenant](./tenants.md) collection of whoever's viewing. People who aren't tenant members will get an error.
+
+For the full list of attributes, see [web component attributes](./browser-reference.md#web-component-metabase-browser-attributes).
+
+### Clicking an item opens it inside the embed
+
+Clicking a dashboard or question opens it inside the embed, with breadcrumbs back to the collection. People can filter, summarize, and drill through anything they open.
+
+By default, people won't be able to save questions to the collection.
+
+### Let people save changes
+
+If you want people to be able to edit _and_ save the dashboards and questions they open, set `read-only="false"`:
+
+```html
+<metabase-browser initial-collection="123" read-only="false"></metabase-browser>
+```
+
+Under the hood, `read-only` decides which dashboard component people land on: a read-only browser opens dashboards for exploring, while `read-only="false"` opens them for [editing](./dashboard.md#web-component-editable-dashboard).
+
+Which collection people can save something to depends on whether it's a new item or not:
+
+- **A new question or dashboard** will be saved in the collection they're browsing. The save dialog preselects that collection, and people can pick any other collection they can write to, which comes down to [collection permissions](../permissions/collections.md). Everyone can always write to their own personal collection, so that shows up as an option even if you've not given people [curate access](../permissions/collections.md#curate-access) to any collection.
+- **Changes to a dashboard or question they opened from the browser** overwrite the original, wherever it lives. If they save a question as a new question instead, it goes to the collection they're browsing. Either way, there's no collection picker, so people can't file it somewhere else.
+
+People in a [tenant](./tenants.md) see two writable options in that picker: their tenant collection, which Metabase labels **Our data**, and their own personal collection. Tenant collections and personal collections both give people curate access that you can't turn off, so a tenant collection browser will always offer somewhere to save. People in a tenant have no access to **Our analytics**, so it won't show up.
+
+There's no `<metabase-browser>` attribute that fixes the save target to one collection, the way `target-collection` does on `<metabase-question>`. Check out [Let people save their changes](./chart.md#let-people-save-their-changes).
+
+### Add new question and new dashboard buttons
+
+The browser can show a **New question** button and a **New dashboard** button above the list of items.
+
+- `with-new-question` defaults to `true`. **New question** ignores `read-only`, so the button shows up even on a read-only browser.
+- `with-new-dashboard` also defaults to `true`, but **New dashboard** only shows up when you set `read-only="false"`.
+- Either button only shows up for people with [curate access](../permissions/collections.md#curate-access) to the collection you named in `initial-collection`.
+
+So a default `<metabase-browser>` gives people **New question** and nothing else. Add `read-only="false"` and they get both buttons. To turn a button off, set its attribute to `false`. Here, people get **New question** but not **New dashboard**:
+
+```html
+<metabase-browser
+ initial-collection="123"
+ read-only="false"
+ with-new-dashboard="false"
+></metabase-browser>
+```
+
+Because **New question** ignores `read-only`, people on a read-only browser can open the query builder and explore, but they won't be able to save what they build, or overwrite an existing question.
+
+The new question button opens the query builder with every table, model, and saved question people have access to. To narrow down the list of entity types people can choose, list the entity types you want in `data-picker-entity-types`. Limiting people to [models](../data-modeling/models.md), for example, means they build on your curated data rather than on raw tables:
+
+```html
+<metabase-browser
+ initial-collection="123"
+ read-only="false"
+ data-picker-entity-types="['model']"
+></metabase-browser>
+```
+
+### Let people follow links to other dashboards and questions
+
+By default, clicking a link (like from a [link card](../dashboards/introduction.md#link-cards)) from inside a dashboard does nothing, so people stay inside the collection you gave them. Turn on `enable-entity-navigation` to let them follow those links:
+
+```html
+<metabase-browser
+ initial-collection="123"
+ enable-entity-navigation="true"
+></metabase-browser>
+```
+
+People can still only open content their collection permissions allow.
+
+## React SDK collection browser
+
+{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
+
+The SDK's `CollectionBrowser` lists what's in a collection and tells you when someone clicks an item. It has no create buttons and doesn't open anything on its own. You decide what a click does, and add whatever buttons you want. `CollectionBrowser` does render its own breadcrumbs, though, so people can navigate into subcollections and back out again.
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/collections/collection-browser.tsx" %}
+```
+
+`collectionId` takes a collection ID (sequential or entity), or one of `"root"`, `"personal"`, or `"tenant"`. It defaults to `"personal"`, so unless you want people to start in their own personal collection, you should pass an explicit value.
+
+For the full list of props, see [`CollectionBrowser` props](./browser-reference.md#react-sdk-collectionbrowser-props).
+
+### Decide what happens when someone clicks an item
+
+Use `onClick` to render a Metabase component, route somewhere in your app, or open a modal.
+
+`onClick` hands you the `item` that was clicked. Check `item.model` to find out what was clicked. Here, `card` is a question, and `dataset` is a model.
+
+One quirk: when someone clicks on a collection, `CollectionBrowser` navigates into that collection _and_ calls `onClick`. So skip `"collection"` in your handler, or you'll move people twice.
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/collections/collection-browser-click.tsx" %}
+```
+
+## Further reading
+
+- [Browser component reference](./browser-reference.md)
+- [Embed a dashboard](./dashboard.md)
+- [Embed a chart](./chart.md)
+- [Embed the query builder](./query-builder.md)
+- [Appearance](./appearance.md)
+- [Collections](../exploration-and-organization/collections.md)
+- [Collection permissions](../permissions/collections.md)
+- [Authentication](./authentication.md)
+- [Modular embedding SDK](./sdk/introduction.md)
diff --git a/docs/embedding/chart.md b/docs/embedding/chart.md
index 15f463943bf..b04096d6a14 100644
--- a/docs/embedding/chart.md
+++ b/docs/embedding/chart.md
@@ -13,8 +13,6 @@ There are two ways you can embed a chart (called a question, in Metabase parlanc
- [View-only chart](#embed-a-view-only-chart): people see the results, filter them, and that's it.
- [Interactive chart](#embed-an-interactive-chart): people can drill through the chart and change the query behind it.
-To let people build questions from scratch instead, check out [Embed the query builder](./query-builder.md). To embed an AI chat component, check out [AI chat](./sdk/ai-chat.md).
-
## Embed a view-only chart
![Static question](./images/static-question.png)
@@ -39,23 +37,19 @@ You can use the in-app wizard to set up a view-only chart using web components.
![In-app embedding wizard](./images/in-app-embedding-wizard.png)
-Before you start, an admin needs to [turn on guest embedding](./guest-embedding.md#turning-on-guest-embedding-in-metabase).
-
Three things need to happen: you publish the embed in Metabase, you paste the chart code into your app, and your server signs a JWT. The wizard writes most of the code for you, so the list below is longer than the work.
1. Visit the question in your Metabase.
2. Click the **Share** icon in the upper right.
3. Select **Embed** to open the embedding wizard.
-4. For authentication, choose **Guest**, so your app won't need to log anyone in to your Metabase.
-5. Click the **Publish** button. Publishing only applies to guest embeds. (There's nothing to publish for an SSO embed, because in that case people can explore the data based on their data and collection permissions.)
-6. Under behavior, Metabase gives you several options for customizing how the embed works. See [web component attributes](./question-reference.md#metabase-question-web-component-attributes) for what each one does. If you'd picked SSO in step 4, this is where you'd make the embed view-only by turning off drill-through.
+4. For authentication, choose **Guest**, so your app won't need to log anyone in to your Metabase. An admin needs to [turn on guest embedding](./guest-embedding.md#turning-on-guest-embedding-in-metabase) first.
+5. Click the **Publish** button. Publishing only applies to guest embeds.
+6. Under behavior, Metabase gives you several options for customizing how the embed works. See [web component attributes](./question-reference.md#web-component-metabase-question-attributes) for what each one does. If you'd picked SSO in step 4, this is where you'd make the embed view-only by turning off drill-through.
7. If you're embedding a SQL question with a variable, set the parameter to **Editable** or **Locked**. Parameters are **Disabled** by default, which hides them and prevents your server from setting them. See [Configuring parameters](./guest-embedding.md#configuring-parameters).
8. Customize the [appearance](./appearance.md).
9. Click the **Get code** button. You'll get both the frontend and backend code based on the selections you made in the wizard.
10. Copy the client code and paste it in your app.
-11. Remove the hardcoded JWT tokens in your HTML. Fetch the token from your backend and pass the token to the component programmatically.
-
-To keep an embed alive after its token expires, configure a token endpoint with [`guestEmbedProviderUri`](./guest-embedding.md#refreshing-or-initializing-the-jwt-from-your-server).
+11. Replace the JWT the wizard pasted into your HTML. That token is a fixed string with an expiration baked into it, so an embed that ships with it will stop working. Either sign a fresh token on your server for each page load and render it into the `token` attribute, or leave the attribute off and point [`guestEmbedProviderUri`](./guest-embedding.md#refreshing-or-initializing-the-jwt-from-your-server) at an endpoint in your app, which also keeps the embed alive past the expiration. The example below takes the first route; for the second, see [Embed a dashboard](./dashboard.md#web-component-view-only-dashboard-example).
#### View-only chart example with web components
@@ -96,7 +90,8 @@ Now say you want to embed this question on each customer's account page in your
</script>
<!--
-Fetch the JWT token from your backend and programmatically pass it to the 'metabase-question'.
+Your server signs this token for each page load and renders it here. Don't
+paste a fixed JWT into your HTML: it'll stop working once it expires.
-->
<metabase-question
token="PASS_SIGNED_TOKEN_FROM_SERVER"
@@ -136,7 +131,7 @@ To get this code from the in-app wizard, set the `customer_id` parameter to **Lo
For all modular embeds, you can also set a `locale` in your page-level configuration to [translate embedded content](./translations.md).
-For the full list of attributes, see [web component attributes](./question-reference.md#metabase-question-web-component-attributes).
+For the full list of attributes, see [web component attributes](./question-reference.md#web-component-metabase-question-attributes).
### View-only charts using the React SDK
@@ -150,7 +145,7 @@ To embed a view-only chart with the [SDK](./sdk/introduction.md), use the `Stati
The component has a default height, which you can change with the `height` prop. To inherit the height from the parent container, pass `100%`.
-For the full list of props, see [`StaticQuestion` props](./question-reference.md#staticquestion-props).
+For the full list of props, see [`StaticQuestion` props](./question-reference.md#react-sdk-staticquestion-props).
## Embed an interactive chart
@@ -168,12 +163,12 @@ Interactive charts require SSO, which you can set up with either web components
Reference an existing question by ID. [Drill-through](../questions/visualizations/drill-through.md) is on by default:
```html
-<metabase-question question-id="Xk3YzAbCdEfGhIjKlMnOp"></metabase-question>
+<metabase-question question-id="1"></metabase-question>
```
-You can pass a sequential ID like `1`, but an [entity ID](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) is the better bet: entity IDs stay the same when you move content between instances, like from staging to production.
+`question-id` takes the question's sequential ID — the number in the question's URL. On Pro and Enterprise plans, you can use the question's [entity ID](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; entity IDs stay the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production.
-To control what people can do with the chart, check out [web component attributes](./question-reference.md#metabase-question-web-component-attributes). For example, you can show or hide download buttons, the question's title, or the chart type selector.
+To control what people can do with the chart, check out [web component attributes](./question-reference.md#web-component-metabase-question-attributes). For example, you can show or hide download buttons, the question's title, or the chart type selector.
### Interactive charts using the React SDK
@@ -185,11 +180,11 @@ Use `InteractiveQuestion` when you want people to explore their data and customi
{% include_file "{{ dirname }}/sdk/snippets/questions/interactive-question.tsx" %}
```
-For the full list of props, see [`InteractiveQuestion` props](./question-reference.md#interactivequestion-props).
+For the full list of props, see [`InteractiveQuestion` props](./question-reference.md#react-sdk-interactivequestion-props).
#### Customize the layout of an interactive chart
-`InteractiveQuestion` comes with a default layout that lets people view the question, apply filters and aggregations, and use the query builder. You can also build your own layout out of namespaced components like `<InteractiveQuestion.Filter />`. For examples of both, see [Customizing an interactive chart's layout](./question-reference.md#customize-the-layout-of-an-interactive-chart), and the full list of [`InteractiveQuestion` components](./question-reference.md#interactivequestion-components).
+`InteractiveQuestion` comes with a default layout that lets people view the question, apply filters and aggregations, and use the query builder. You can also build your own layout out of namespaced components like `<InteractiveQuestion.Filter />`. For examples of both, see [Customizing an interactive chart's layout](./question-reference.md#customize-the-layout-of-an-interactive-chart), and the full list of [`InteractiveQuestion` components](./question-reference.md#react-sdk-interactivequestion-components).
### Let people save their changes
@@ -201,7 +196,7 @@ With a web component, turn saving on with `is-save-enabled="true"`, and set the
```html
<metabase-question
- question-id="Xk3YzAbCdEfGhIjKlMnOp"
+ question-id="1"
is-save-enabled="true"
target-collection="5"
></metabase-question>
@@ -246,9 +241,9 @@ You can also customize how custom actions look in the menu:
To let people build questions from scratch, check out [Embed the query builder](./query-builder.md).
-## Control parameters from your app
+## Show people only their own data
-Say you want to show each customer only their own orders. How you filter the results depends on how you authenticate the embed.
+Say you want to show each customer only their own orders. How you restrict the rows depends on how you authenticate the embed.
### Lock a parameter on a guest embed
@@ -272,19 +267,23 @@ const token = jwt.sign(payload, METABASE_SECRET_KEY);
Embeds with **SSO** don't need to lock parameters. Since Metabase knows who's viewing, you can apply [data permissions](../permissions/embedding.md) and let Metabase filter the rows, instead of locking parameters by hand. This works for query builder questions and SQL questions alike.
-### Set parameter values from your app
+## Control question parameters from your app
-You can also pass values to a question's [SQL parameters](../questions/native-editor/sql-parameters.md) in the format `{parameter_name: parameter_value}`, and keep your app in sync as people change them. Set the values once on load, or hold the values in your app and get a callback whenever they change.
+To drive a question's parameters from your app's own code, pass values to its [SQL parameters](../questions/native-editor/sql-parameters.md) in the format `{parameter_name: parameter_value}`. Set the values once on load, or hold the values in your app and get a callback whenever they change. Holding the values in your app is what lets you build your own parameter widgets instead of using Metabase's.
For both the SDK props (`initialSqlParameters`, `sqlParameters`, and `onSqlParametersChange`) and the web component equivalents, see [Modular embedding parameters](./parameters.md).
### Hide a parameter
-To hide a parameter from the question's UI, use the [`hidden-parameters`](./question-reference.md#metabase-question-web-component-attributes) attribute (web component) or the `hiddenParameters` prop (SDK). Both require a Pro or Enterprise plan and an SSO embed; `hidden-parameters` has no effect on a guest embed. To hide a parameter on a guest embed, set the parameter to **Locked** or leave it **Disabled** in the question's embed settings.
+To hide a parameter from the question's UI, use the [`hidden-parameters`](./question-reference.md#web-component-metabase-question-attributes) attribute (web component) or the `hiddenParameters` prop (SDK). Both work in any modular embed, on any plan.
+
+In practice you'll reach for them on [SSO embeds](./introduction.md#components-with-sso-authentication), where every parameter on the question shows up by default. On a [guest embed](./guest-embedding.md), a parameter that you haven't set to **Editable** or **Locked** is already hidden.
+
+Hiding a parameter declutters the UI; it doesn't restrict what people can query. Setting a value with `initial-sql-parameters` and then hiding the widget isn't a secure way to filter data, because your app sets that value in the browser. To restrict the data itself, see [Show people only their own data](#show-people-only-their-own-data).
## Let people set up alerts on a question
-You can let people set up [alerts](../questions/alerts.md) on a saved question with the [`with-alerts`](./question-reference.md#metabase-question-web-component-attributes) attribute on the web component:
+You can let people set up [alerts](../questions/alerts.md) on a saved question with the [`with-alerts`](./question-reference.md#web-component-metabase-question-attributes) attribute on the web component:
```html
<metabase-question question-id="42" with-alerts="true"></metabase-question>
@@ -312,7 +311,7 @@ Alerts created in an embedded context only send to whoever's logged in, and they
You can theme an embedded question and toggle parts of its UI. For the full set of theming options, see [Appearance](./appearance.md). For every attribute and prop, see the [Question component reference](./question-reference.md).
- **Title**: show or hide the question title with `with-title` (web component) or `title` (SDK).
-- **Downloads**: show or hide download buttons with `with-downloads` / `withDownloads`. Defaults to `true` on OSS/Starter and `false` on Pro/Enterprise. Disabling downloads requires a [Pro](https://www.metabase.com/product/pro) or [Enterprise](https://www.metabase.com/product/enterprise) plan.
+- **Downloads**: show or hide download buttons with `with-downloads` / `withDownloads`. Defaults to `false` on Pro and Enterprise, so set it to `true` if you want people to be able to download results. On OSS and Starter, downloads are always on; turning them off requires a [Pro](https://www.metabase.com/product/pro) or [Enterprise](https://www.metabase.com/product/enterprise) plan.
- **Chart type selector**: show or hide it with `withChartTypeSelector` (SDK).
- **Theme**: set a light or dark preset, or (on Pro/Enterprise) customize colors and fonts. The `question` component in the theme has its own overrides:
@@ -334,13 +333,12 @@ You can theme an embedded question and toggle parts of its UI. For the full set
Colors set in a question's visualization settings override theme colors.
-### The "Powered by Metabase" banner
-
-Metabase adds a "Powered by Metabase" banner to guest embeds (both charts and dashboards) on the OSS and Starter plans. To remove the banner, upgrade to a [Pro](https://www.metabase.com/product/pro) or [Enterprise](https://www.metabase.com/product/enterprise) plan.
+On the OSS and Starter plans, Metabase adds a "Powered by Metabase" banner to guest embeds. See [Removing the "Powered by Metabase" banner](./guest-embedding.md#removing-the-powered-by-metabase-banner).
## Further reading
- [Question component reference](./question-reference.md)
+- [Embed a dashboard](./dashboard.md)
- [Embed the query builder](./query-builder.md)
- [Appearance](./appearance.md)
- [Modular embedding parameters](./parameters.md)
diff --git a/docs/embedding/components.md b/docs/embedding/components.md
index a475bf5e4f4..2d7d0c72d1b 100644
--- a/docs/embedding/components.md
+++ b/docs/embedding/components.md
@@ -15,36 +15,8 @@ This page covers what you can embed. For theming your embeds, see [Appearance](.
## Dashboard
-To render a dashboard:
-
-```html
-<metabase-dashboard dashboard-id="1" with-title="true" with-downloads="false">
-</metabase-dashboard>
-```
-
-### Attributes
-
-{% include_file "{{ dirname }}/eajs/snippets/MetabaseDashboardAttributes.md" snippet="properties" %}
-
-For all modular embeds, you can also set a `locale` in your page-level configuration to [translate embedded content](./translations.md), including content from translation dictionaries.
-
-If you surround your attribute value with double quotes, make sure to use single quotes:
-
-```html
-<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:
-
-```html
-<metabase-dashboard
- dashboard-id="1"
- hidden-parameters="['productId']"
-></metabase-dashboard>
-```
+- [Embed a dashboard](./dashboard.md)
+- [Dashboard component reference](./dashboard-reference.md), for `<metabase-dashboard>` attributes and SDK props
## Question
@@ -56,22 +28,8 @@ If you surround your attribute value with double quotes, make sure to use single
{% include plans-blockquote.html feature="Browser component" convert_pro_link_to_embedding=true%}
-Browser component is only available for authenticated modular embeds. It's unavailable for [Guest embeds](./guest-embedding.md).
-
-To render a collection browser so people can navigate a collection and open dashboards or questions:
-
-```html
-<metabase-browser
- initial-collection="14"
- read-only="false"
- collection-entity-types="['collection', 'dashboard']"
->
-</metabase-browser>
-```
-
-### Attributes
-
-{% include_file "{{ dirname }}/eajs/snippets/MetabaseBrowserAttributes.md" snippet="properties" %}
+- [Embed a collection browser](./browser.md)
+- [Browser component reference](./browser-reference.md), for `<metabase-browser>` attributes and SDK props
## AI chat
diff --git a/docs/embedding/custom-visualizations.md b/docs/embedding/custom-visualizations.md
index c66a31406a6..581f32632bd 100644
--- a/docs/embedding/custom-visualizations.md
+++ b/docs/embedding/custom-visualizations.md
@@ -61,6 +61,8 @@ Add `allowedCustomVisualizations` to `defineMetabaseConfig()`:
<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](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; they stay the same when you [serialize](../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](./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
diff --git a/docs/embedding/dashboard-reference.md b/docs/embedding/dashboard-reference.md
new file mode 100644
index 00000000000..22a6fe38aee
--- /dev/null
+++ b/docs/embedding/dashboard-reference.md
@@ -0,0 +1,108 @@
+---
+title: Dashboard component reference
+summary: "Reference for the metabase-dashboard web component attributes, the StaticDashboard, InteractiveDashboard, and EditableDashboard SDK props, and the dashboard creation components."
+---
+
+# Dashboard component reference
+
+Reference material for embedding a dashboard: the attributes you can set on the `<metabase-dashboard>` web component, the props you can pass to the SDK's `StaticDashboard`, `InteractiveDashboard`, and `EditableDashboard` components, and the options for creating dashboards from your app.
+
+For how to set all this up, check out [Embed a dashboard](./dashboard.md).
+
+## Web component `metabase-dashboard` attributes
+
+These attributes apply to the `<metabase-dashboard>` web component. For the SDK, see [`StaticDashboard` props](#react-sdk-staticdashboard-props), [`InteractiveDashboard` props](#react-sdk-interactivedashboard-props), and [`EditableDashboard` props](#react-sdk-editabledashboard-props).
+
+{% include_file "{{ dirname }}/eajs/snippets/MetabaseDashboardAttributes.md" snippet="properties" %}
+
+Depending on the framework you're using, you may need to stringify attributes before passing them to the component. And if you surround an attribute's value with double quotes, use single quotes inside it:
+
+```html
+<metabase-dashboard
+ dashboard-id="1"
+ initial-parameters="{ 'productId': '42' }"
+ hidden-parameters="['productId']"
+></metabase-dashboard>
+```
+
+These examples use sequential IDs — the number in the item's URL. On Pro and Enterprise plans, you can use [entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; they stay the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production.
+
+For all modular embeds, you can also set a `locale` in your page-level configuration to [translate embedded content](./translations.md), including content from translation dictionaries.
+
+## React SDK `StaticDashboard` props
+
+{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
+
+`StaticDashboard` embeds a [view-only dashboard](./dashboard.md#embed-a-view-only-dashboard): a lightweight component that displays results without letting people interact with the data.
+
+- [Component](./sdk/api/StaticDashboard.html)
+- [Props](./sdk/api/StaticDashboardProps.html)
+
+{% include_file "{{ dirname }}/sdk/api/snippets/StaticDashboardProps.md" snippet="properties" %}
+
+## React SDK `InteractiveDashboard` props
+
+{% include plans-blockquote.html feature="Interactive dashboards" convert_pro_link_to_embedding=true is_plural=true %}
+
+`InteractiveDashboard` embeds an [interactive dashboard](./dashboard.md#embed-an-interactive-dashboard), with drill-downs, click behaviors, and the ability to view and click into questions.
+
+- [Component](./sdk/api/InteractiveDashboard.html)
+- [Props](./sdk/api/InteractiveDashboardProps.html)
+
+{% include_file "{{ dirname }}/sdk/api/snippets/InteractiveDashboardProps.md" snippet="properties" %}
+
+## React SDK `EditableDashboard` props
+
+{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
+
+`EditableDashboard` does everything `InteractiveDashboard` does, and also lets people [edit the dashboard](./dashboard.md#react-sdk-editable-dashboard): add and update questions, layout, and content.
+
+- [Component](./sdk/api/EditableDashboard.html)
+- [Props](./sdk/api/EditableDashboardProps.html)
+
+{% include_file "{{ dirname }}/sdk/api/snippets/EditableDashboardProps.md" snippet="properties" %}
+
+## React SDK `CreateDashboardModal` props
+
+{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
+
+`CreateDashboardModal` lets people [create a new dashboard](./dashboard.md#createdashboardmodal) from your app.
+
+- [Component](./sdk/api/CreateDashboardModal.html)
+- [Props](./sdk/api/CreateDashboardModalProps.html)
+
+{% include_file "{{ dirname }}/sdk/api/snippets/CreateDashboardModalProps.md" snippet="properties" %}
+
+## React SDK `useCreateDashboardApi` options
+
+{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
+
+`useCreateDashboardApi` [creates a dashboard](./dashboard.md#usecreatedashboardapi) without Metabase's own modal, so you can build your own UI.
+
+- [Hook](./sdk/api/useCreateDashboardApi.html)
+- [Options](./sdk/api/CreateDashboardValues.html)
+
+{% include_file "{{ dirname }}/sdk/api/snippets/CreateDashboardValues.md" snippet="properties" %}
+
+## React SDK `dashboardCardMenu` plugin
+
+{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
+
+`dashboardCardMenu` controls the overflow menu on each dashboard card. It takes either a config object with the keys below, or a function returning a React element.
+
+| Key | What it does |
+| --------------- | ---------------------------------------------------------------------------------------------------------------------- |
+| `withDownloads` | Shows or hides the download button. |
+| `withEditLink` | Shows or hides the link to edit the question. |
+| `customItems` | Your own menu items. Each element is either an item object or a function that receives `{ question }` and returns one. |
+
+See [Customize the menu on dashboard cards](./dashboard.md#customize-the-menu-on-dashboard-cards-react-sdk-only).
+
+## Further reading
+
+- [Embed a dashboard](./dashboard.md)
+- [Embed the query builder](./query-builder.md)
+- [Question component reference](./question-reference.md)
+- [Modular embedding components](./components.md)
+- [Modular embedding parameters](./parameters.md)
+- [Appearance](./appearance.md)
diff --git a/docs/embedding/dashboard.md b/docs/embedding/dashboard.md
new file mode 100644
index 00000000000..ec45d5f9559
--- /dev/null
+++ b/docs/embedding/dashboard.md
@@ -0,0 +1,556 @@
+---
+title: Embed a dashboard
+summary: "Embed a Metabase dashboard in your app — view-only, interactive, or editable — with a web component or using the React SDK."
+redirect_from:
+ - /docs/latest/embedding/sdk/dashboards
+---
+
+# Embed a dashboard
+
+![Embedded dashboard from Shoppy, our SDK demo](./images/embedded-dashboard.png)
+
+_Embedded dashboard from our SDK demo site, [Shoppy](https://embedded-analytics-sdk-demo.metabase.com)_
+
+There are three ways you can embed a dashboard:
+
+- [View-only dashboard](#embed-a-view-only-dashboard): people see the results, filter them, and that's it.
+- [Interactive dashboard](#embed-an-interactive-dashboard): people can drill through the charts on the dashboard and explore the data behind them.
+- [Editable dashboard](#embed-an-editable-dashboard): people also can add cards, rearrange the layout, and save the changes.
+
+## Embed a view-only dashboard
+
+A view-only (a.k.a. "static") dashboard displays results without letting people explore the data. Nobody can drill through the charts or change the questions behind them. You can, however, add editable filters that people can change to update the results, as well as locked filters you can use to filter results based on who is logged in to your app.
+
+- [Web component](#web-component-view-only-dashboard)
+- [React SDK](#react-sdk-view-only-dashboard)
+
+View-only isn't tied to one kind of embed:
+
+- **[Guest embeds](./introduction.md#components-with-guest-authentication)**: always view-only. Nobody logs in to a guest embed, so Metabase has no account to check permissions against.
+- **[SSO embeds](./introduction.md#components-with-sso-authentication)**: interactive by default. To make one view-only, turn off drill-through with `drills="false"` (web component), or use `StaticDashboard` instead of `InteractiveDashboard` (SDK).
+
+For view-only items, you'll almost always want to go with guest authentication (so you don't have to pay for each person viewing the item). If, however, you also want people to be able to self-serve data (in addition to displaying view-only items), go with SSO. Check out [SSO or guest embeds](./introduction.md#comparison-between-sso-and-guest-authentication).
+
+### Web component view-only dashboard
+
+You can use the in-app wizard to set up a view-only dashboard using web components. These steps walk through a guest embed.
+
+![In-app embedding wizard](./images/in-app-embedding-wizard.png)
+
+Three things need to happen: you publish the dashboard embed in Metabase, you paste the dashboard code into your app (both frontend and backend), and your server signs a JWT. The in-app wizard writes most of the code for you.
+
+1. Visit the dashboard in your Metabase.
+2. Click the **Share** icon in the upper right.
+3. Select **Embed** to open the embedding wizard.
+4. For authentication, choose **Guest**, so your app won't need to log anyone in to your Metabase. An admin needs to [turn on guest embedding](./guest-embedding.md#turning-on-guest-embedding-in-metabase) first.
+5. Click the **Publish** button (publishing only applies to embeds with guest authentication).
+6. Under **Behavior**, Metabase gives you several options for customizing how the embed works. See [web component attributes](./dashboard-reference.md#web-component-metabase-dashboard-attributes) for what each attribute does. With guest embeds, you can only control whether people can download the data. If you'd picked SSO in step 4, this is where you'd make the embed view-only by turning off drill-through.
+7. If your dashboard has filters, set each filter to **Editable** or **Locked**, or leave it as **Disabled**. Filters are disabled by default, which hides the filter and blocks both sides from setting it: your server can't pass a value for it in the JWT, and the person viewing can't change it in the UI. See [Configuring parameters](./guest-embedding.md#configuring-parameters).
+8. Customize the [appearance](./appearance.md).
+9. Click the **Get code** button. You'll get both the frontend and backend code based on the selections you made in the wizard.
+10. Copy the client code and paste it in your app.
+11. Replace the JWT the wizard pasted into your HTML. That token is a fixed string with an expiration baked into it, so an embed that ships with it will stop working.
+
+You have two ways to hand the component a token that won't go stale:
+
+- **Sign a token per page load.** Your server signs a fresh JWT for each request and renders it into the `token` attribute. See [Server-side code](./guest-embedding.md#server-side-code) for the signing code.
+- **Let the embed fetch its own.** Leave the `token` attribute off, and point [`guestEmbedProviderUri`](./guest-embedding.md#refreshing-or-initializing-the-jwt-from-your-server) at an endpoint in your app. The embed calls that endpoint for its first token on load, and again whenever the current token expires, so the embed keeps working past that expiration.
+
+The example below takes the second route.
+
+#### Web component view-only dashboard example
+
+Say you have a sales dashboard with a **Customer** filter, and you want to put it on each customer's account page in your app, showing only that customer's numbers.
+
+Set the **Customer** filter to **Locked** in the dashboard's embed settings. Locked means your server picks the filter's value and puts it in the signed token, so the value never reaches the browser: the person on the page can't see it, and they can't change it. An embed on customer 13's account page returns customer 13's rows and nothing else. It has to work this way, because a guest embed doesn't sign anyone in to your Metabase---only your app knows whose account page this is.
+
+Here's the frontend code:
+
+```html
+<!-- embed.js defines the <metabase-dashboard> element -->
+<script defer src="https://your-metabase.example.com/app/embed.js"></script>
+<script>
+ function defineMetabaseConfig(config) {
+ window.metabaseConfig = config;
+ }
+</script>
+
+<script>
+ // Page-level config, shared by every Metabase component on the page
+ defineMetabaseConfig({
+ instanceUrl: "https://your-metabase.example.com",
+ isGuest: true,
+ // Your app's token endpoint. The embed calls it for its first token on
+ // load, and again whenever the current token expires.
+ guestEmbedProviderUri: "/api/metabase-guest-token",
+ theme: {
+ colors: {
+ brand: "#509EE3",
+ "text-primary": "hsla(204, 66%, 8%, 0.84)",
+ },
+ },
+ });
+</script>
+
+<!-- No token in the HTML. The embed gets one from your endpoint. -->
+<metabase-dashboard
+ dashboard-id="1"
+ with-title="true"
+ with-downloads="true"
+></metabase-dashboard>
+```
+
+The `theme` key sets the dashboard's appearance. For the full theme object with all the options, check out [Appearance](./appearance.md).
+
+And here's the endpoint that signs the token. The embed posts the dashboard's ID to it, along with your app's session cookie, so your server knows both which dashboard to sign for and who's asking:
+
+```javascript
+const jwt = require("jsonwebtoken");
+
+// Your embedding secret key. Keep it on your server; it never reaches the browser.
+const METABASE_SECRET_KEY = process.env.METABASE_SECRET_KEY;
+
+app.post("/api/metabase-guest-token", (req, res) => {
+ // Work out the customer from your app's own session, not from the request
+ // body---the page never says whose account page it's on.
+ const customerId = req.session?.customerId;
+
+ if (!customerId) {
+ return res.status(403).json({ error: "Not signed in" });
+ }
+
+ const { entityType, entityId } = req.body;
+
+ // Authorize the request. The browser picks the entityType and entityId, so
+ // check them against your own rule before signing for them.
+ // This is just an example:
+ if (!customerCanView(customerId, entityType, entityId)) {
+ return res.status(403).json({ error: "Not allowed" });
+ }
+
+ const payload = {
+ resource: { [entityType]: entityId },
+ params: {
+ // Key each param by the filter's slug. Here, the locked Customer filter.
+ customer: [customerId],
+ },
+ exp: Math.round(Date.now() / 1000) + 10 * 60, // 10 minutes
+ };
+
+ res.json({ jwt: jwt.sign(payload, METABASE_SECRET_KEY) });
+});
+```
+
+Your endpoint has to return an object with a single `jwt` field. Return anything else and the embed shows an error instead of the dashboard.
+
+Remember to check permissions! With guest authentication, your endpoint is the only thing deciding who gets a token for which dashboard. An endpoint that signs whatever `entityId` it's handed will give anyone signed in to your app a token for any published dashboard.
+
+For more on signing, check out [Locked parameters](./guest-embedding.md#locked-parameters) and the [example token endpoint](./guest-embedding.md#refreshing-or-initializing-the-jwt-from-your-server). To get the signing code from the in-app wizard, set the **Customer** filter to **Locked**. To see the whole thing running, check out our [sample apps](./securing-embeds.md#sample-apps).
+
+For all modular embeds, you can also set a `locale` in your page-level configuration. Metabase translates its own UI automatically; to translate content strings like dashboard names and filter labels, upload a [translation dictionary](./translations.md).
+
+For the full list of attributes, see [web component attributes](./dashboard-reference.md#web-component-metabase-dashboard-attributes).
+
+### React SDK view-only dashboard
+
+{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
+
+To embed a view-only dashboard with the [SDK](./sdk/introduction.md), use the `StaticDashboard` component. Wrap the component in the `MetabaseProvider` component with your auth config.
+
+> The React SDK doesn't support more than one dashboard component on the same page yet. That applies to `StaticDashboard`, `InteractiveDashboard`, and `EditableDashboard` alike, so a page can hold one of them, not two.
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/static-dashboard.tsx" %}
+```
+
+For the full list of props, see [`StaticDashboard` props](./dashboard-reference.md#react-sdk-staticdashboard-props).
+
+## Embed an interactive dashboard
+
+{% include plans-blockquote.html feature="Interactive dashboards" convert_pro_link_to_embedding=true is_plural=true %}
+
+![Interactive embedded dashboard, with tabs and filters](./images/embedded-example-dashboard.png)
+
+An interactive dashboard lets people explore their data: they can drill through the charts on the dashboard, filter results, and open the questions behind the cards to summarize and group them.
+
+Interactive dashboards require SSO, which you can set up with either web components or the React SDK.
+
+- [Web component](#web-component-interactive-dashboard)
+- [React SDK](#react-sdk-interactive-dashboard)
+
+### Web component interactive dashboard
+
+Reference an existing dashboard by ID. [Drill-through](../questions/visualizations/drill-through.md) is on by default:
+
+```html
+<metabase-dashboard dashboard-id="1"></metabase-dashboard>
+```
+
+`dashboard-id` takes the dashboard's sequential ID — the number in the dashboard's URL. On Pro and Enterprise plans, you can use the dashboard's [entity ID](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; entity IDs stay the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production.
+
+To control what people can do with the dashboard, check out [web component attributes](./dashboard-reference.md#web-component-metabase-dashboard-attributes).
+
+#### Let people follow links to other dashboards and questions
+
+By default, clicking a link to another dashboard or question does nothing, so people stay on the one thing you embedded. To let them navigate to linked content inside an SSO embed, turn on `enable-entity-navigation`:
+
+```html
+<metabase-dashboard
+ dashboard-id="1"
+ drills="true"
+ enable-entity-navigation="true"
+></metabase-dashboard>
+```
+
+Entity navigation needs `drills` set to `true`, because `drills="false"` renders a [view-only dashboard](#embed-a-view-only-dashboard) instead of an interactive one, and a view-only dashboard has nowhere to navigate to.
+
+In the SDK, the equivalent prop is `enableEntityNavigation`, which is also off by default. Either way, people can still only open content they have [collection permissions](../permissions/collections.md) for.
+
+### React SDK interactive dashboard
+
+Use `InteractiveDashboard` when you want people to explore their data.
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/interactive-dashboard.tsx" %}
+```
+
+For the full list of props, see [`InteractiveDashboard` props](./dashboard-reference.md#react-sdk-interactivedashboard-props).
+
+#### Customize the drill-through question layout
+
+Drilling through or clicking on a question card in the dashboard takes people to the question view with the [default layout](./question-reference.md#customize-the-layout-of-an-interactive-chart) for interactive questions.
+
+To customize that layout, pass a `renderDrillThroughQuestion` prop to `InteractiveDashboard`, with your custom view as the child component.
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/custom-drill-through-question-layout.tsx" snippet="example-1" %}
+
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/custom-drill-through-question-layout.tsx" snippet="example-2" %}
+```
+
+`renderDrillThroughQuestion` accepts a React component, which you can build out of the namespaced components inside `InteractiveQuestion`. See [customize the layout](./question-reference.md#customize-the-layout-of-an-interactive-chart).
+
+## Embed an editable dashboard
+
+![Editable embedded dashboard in edit mode](./images/editabledashboard.png)
+
+An editable dashboard does everything an interactive dashboard does, and also lets people add and update questions and other cards, and rearrange the dashboard's layout.
+
+- [Web component](#web-component-editable-dashboard)
+- [React SDK](#react-sdk-editable-dashboard)
+
+Editing requires SSO.
+
+Whoever's editing needs [curate access](../permissions/collections.md#curate-access) to the collection the dashboard lives in. Dashboards in the [usage analytics](../usage-and-performance-tools/usage-analytics.md) collection are the exception: they're always read-only, whatever the permissions say.
+
+People in a [tenant](./tenants.md) can only be granted **View** access to the shared collections you publish to every tenant, so they can never edit those dashboards. They can, however, edit dashboards in their own tenant collection.
+
+If the dashboard renders but the edit pencil doesn't appear, the person viewing it lacks write access to that dashboard---check the `can_write` field on `GET /api/dashboard/:id` as that person.
+
+### Web component editable dashboard
+
+{% include plans-blockquote.html feature="Browser component" convert_pro_link_to_embedding=true%}
+
+There's no `<metabase-dashboard>` attribute that turns on editing, so there's no built-in way to embed one editable dashboard with a web component. If you're building in React, [`EditableDashboard`](#react-sdk-editable-dashboard) in the SDK is the direct route.
+
+Depending on your app, you may be able to get there with the [collection browser](./browser.md) instead. Set `read-only="false"`, and every dashboard people open from that browser comes with the editing pencil icon:
+
+```html
+<metabase-browser initial-collection="123" read-only="false"></metabase-browser>
+```
+
+The tradeoff: people have to find the dashboard by navigating the collection you point `initial-collection` at, since there's no attribute that opens the browser on one specific dashboard. That works if browsing is something you wanted in your app anyway; it's a detour if you only ever wanted to show one dashboard.
+
+If you only want people editing one dashboard, give that dashboard a collection of its own and point `initial-collection` at it. People land on a one-item list and click through to an editable dashboard. The detour is one click, and there's nowhere else to wander.
+
+Setting `read-only="false"` also adds a **New dashboard** button, so the same embed lets people create dashboards. Check out [Add new question and new dashboard buttons](./browser.md#add-new-question-and-new-dashboard-buttons).
+
+For the full list of attributes, see [web component attributes](./browser-reference.md#web-component-metabase-browser-attributes).
+
+### React SDK editable dashboard
+
+{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
+
+`EditableDashboard` does everything `InteractiveDashboard` does, and also lets people add and update questions, content, and the dashboard's layout. Unlike the web component, you can point it at a single dashboard, with no collection browser around it.
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/editable-dashboard.tsx" %}
+```
+
+When someone adds a new question to a dashboard, `EditableDashboard` opens the query builder. To narrow what they can query, pass `dataPickerProps` with the entity types you want in the data picker: `"table"`, `"question"`, or `"model"`. For example, limiting people to tables keeps them building on the data you point them at, rather than on other people's saved questions:
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/editable-dashboard-data-picker.tsx" %}
+```
+
+For the full list of props, see [`EditableDashboard` props](./dashboard-reference.md#react-sdk-editabledashboard-props).
+
+## Let people create dashboards
+
+- [Web component](#web-component-dashboard-creation)
+- [React SDK](#react-sdk-dashboard-creation)
+
+### Web component dashboard creation
+
+There's no attribute that creates a dashboard on its own. Set `read-only="false"` on the [collection browser](./browser.md#add-new-question-and-new-dashboard-buttons), and people get a **New dashboard** button. Metabase suggests whichever collection the person is browsing as the place to save it, and the new dashboard opens ready to edit.
+
+### React SDK dashboard creation
+
+You can let people create new dashboards from your app with either the `useCreateDashboardApi` hook or the `CreateDashboardModal` component. Both create an empty dashboard, which you'd typically hand to `EditableDashboard` so people can fill it in.
+
+#### `useCreateDashboardApi`
+
+Use the hook when you want total control over the UI. Until the SDK is fully loaded and initialized, the hook returns `null`, so check for that before calling `createDashboard`.
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/create-dashboard.tsx" snippet="example-hook" %}
+```
+
+For the options you can pass, see [`useCreateDashboardApi` options](./dashboard-reference.md#react-sdk-usecreatedashboardapi-options).
+
+#### `CreateDashboardModal`
+
+Use the component when Metabase's own modal is good enough. It hands the new dashboard to `onCreate`:
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/create-dashboard.tsx" snippet="example-component" %}
+```
+
+For the full list of props, see [`CreateDashboardModal` props](./dashboard-reference.md#react-sdk-createdashboardmodal-props).
+
+## Customize the menu on dashboard cards (React SDK only)
+
+Every card on an interactive dashboard gets an overflow menu in its top right corner, with actions like downloading results and editing the question. The `dashboardCardMenu` plugin lets you change what's in that menu, add your own actions, or replace the menu entirely. The plugin is React SDK only; there's no web component equivalent.
+
+Pass the plugin through the `plugins` prop, under the `dashboard` key, on any dashboard component. You can also set it globally on `MetabaseProvider`; a component's own `plugins` prop wins over the global one. Here's `dashboardCardMenu` with its default values:
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/plugins.tsx" snippet="example-base-2" %}
+```
+
+For what each key does, see [`dashboardCardMenu` plugin](./dashboard-reference.md#react-sdk-dashboardcardmenu-plugin).
+
+### Turn off the default actions
+
+To remove the download button from the card's menu, set `withDownloads` to `false`. To remove the edit link, set `withEditLink` to `false`.
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/plugins.tsx" snippet="example-default-actions" %}
+```
+
+### Add your own actions to the menu
+
+Add custom actions by putting objects in the `customItems` array. Each element can be an object, or a function that receives `{ question }` and returns an item:
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/plugins.tsx" snippet="example-custom-action-type" %}
+```
+
+Here's an example:
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/plugins.tsx" snippet="example-custom-actions" %}
+```
+
+### Replace the menu with your own component
+
+To swap out the whole menu, pass a function that returns a React element. The function receives `{ question }`:
+
+```typescript
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/plugins.tsx" snippet="example-custom-actions-menu" %}
+```
+
+### Customize what happens when someone clicks a card
+
+To change the menu people get when they click a data point on a dashboard card, use the `mapQuestionClickActions` plugin. See [Customize what happens when someone clicks on a chart](./chart.md#customize-what-happens-when-someone-clicks-on-a-chart).
+
+To send people somewhere instead---another dashboard, a question, or an external URL---set up a [custom destination](../dashboards/interactive.md#custom-destinations). In guest embeds, you can only use the **URL** option, and external URLs open in a new tab or window. You can propagate filter values into the URL, unless the filter is locked.
+
+## Show people only their own data
+
+Say you want to show each customer only their own numbers. How you restrict the rows depends on how you authenticate the embed.
+
+### Lock a filter on a guest embed
+
+Embeds with **Guest** authentication can [lock a filter](./guest-embedding.md#locked-parameters). Your app sets the filter's value in the signed token on your server, so the value comes from your app rather than from whoever's clicking around the page. They can't see the value, and they can't change it. An embed on a customer's account page returns that account's rows, whether or not Metabase has any idea who's looking at it.
+
+Unlike a question, which needs a SQL variable to lock onto, any dashboard filter can be locked, including filters wired up to query builder questions. Set the filter to **Locked** in the dashboard's embed settings, then pass its value in the token:
+
+```javascript
+const payload = {
+ resource: { dashboard: 1 },
+ params: {
+ category: ["Gadget"], // Locked. Set by your app, not by whoever's viewing.
+ },
+ exp: Math.round(Date.now() / 1000) + 10 * 60,
+};
+
+const token = jwt.sign(payload, METABASE_SECRET_KEY);
+```
+
+A locked filter also narrows the options in every editable filter on the same dashboard, the way [linked filters](../dashboards/filters.md#linking-filters) do. And if the locked filter feeds a SQL question anywhere on the dashboard, the token can carry only one value for it. See [Locked parameters](./guest-embedding.md#locked-parameters).
+
+### Use permissions on an SSO embed
+
+Embeds with **SSO** don't need to lock filters. Since Metabase knows who's viewing, you can apply [data permissions](../permissions/embedding.md) and let Metabase filter the rows, instead of locking filters by hand.
+
+## Control dashboard filters from your app
+
+To drive a dashboard's filters from your app's own code, set their values from the page. The embedding APIs call these values parameters. See [Modular embedding parameters](./parameters.md) for the props, attributes, and events:
+
+- **Set a starting value** that people can still change, with `initial-parameters` (web component) or `initialParameters` (SDK).
+- **Hold the values in your app**, with `parameters` plus the `parameters-change` event (web component), or `onParametersChange` (SDK). Your app becomes the source of truth for the filter values, which is what lets you build your own filter widgets instead of using Metabase's.
+- **Hide Metabase's filter widgets** with `hidden-parameters` (web component) or `hiddenParameters` (SDK), for when your app supplies the filter UI. See [Hide a dashboard filter](./parameters.md#hide-a-dashboard-filter).
+
+Your app sets these values in the browser, and people can change them, so they don't restrict what anyone can query. To restrict the data itself, see [Show people only their own data](#show-people-only-their-own-data).
+
+## Let people set up dashboard subscriptions
+
+You can let people set up [dashboard subscriptions](../dashboards/subscriptions.md) from an embedded dashboard.
+
+- [Web component](#web-component-dashboard-subscriptions)
+- [React SDK](#react-sdk-dashboard-subscriptions)
+
+Either way, Metabase hides the subscriptions button unless all of these are true:
+
+- Your Metabase has [email set up](../configuring-metabase/email.md). Slack on its own won't do it: the button checks for email specifically.
+- The embed is an authenticated (SSO) embed. Guest embeds don't get subscriptions.
+- The dashboard has at least one question card (i.e., not a text or heading card).
+
+Whoever's viewing also needs [collection permissions](../permissions/collections.md) for the collection that holds the dashboard, and the [Subscriptions and alerts](../permissions/application.md#subscriptions-and-alerts) application permission to set one up. Metabase grants that permission to the All Users group by default, so admins have to set it to **No** to take it away.
+
+Subscriptions sent from an embedded dashboard exclude links to Metabase items.
+
+### Web component dashboard subscriptions
+
+Set the [`with-subscriptions`](./dashboard-reference.md#web-component-metabase-dashboard-attributes) attribute:
+
+```html
+<metabase-dashboard
+ dashboard-id="1"
+ with-subscriptions="true"
+></metabase-dashboard>
+```
+
+Drill-through also has to be on: `drills="false"` renders a view-only dashboard, and the web component doesn't pass `with-subscriptions` through to it.
+
+### React SDK dashboard subscriptions
+
+Pass `withSubscriptions` to a dashboard component:
+
+```tsx
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/dashboard-subscriptions.tsx" snippet="example" %}
+```
+
+`StaticDashboard` takes `withSubscriptions` too, so you can show the button on a view-only dashboard.
+
+## Refresh a dashboard automatically
+
+To rerun a dashboard's cards on a timer, set a refresh interval in seconds. Each refresh re-queries your database, so pick an interval your database can keep up with.
+
+- [Web component](#web-component-auto-refresh)
+- [React SDK](#react-sdk-auto-refresh)
+
+### Web component auto-refresh
+
+Set `auto-refresh-interval`:
+
+```html
+<metabase-dashboard
+ dashboard-id="1"
+ auto-refresh-interval="60"
+></metabase-dashboard>
+```
+
+### React SDK auto-refresh
+
+Set `autoRefreshInterval`:
+
+```tsx
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/dashboard-auto-refresh.tsx" snippet="example" %}
+```
+
+## Customize dashboard appearance
+
+You can customize colors, UI, and more.
+
+- [Web component](#web-component-dashboard-appearance)
+- [React SDK](#react-sdk-dashboard-appearance)
+
+### Web component dashboard appearance
+
+- **Title**: show or hide the dashboard title with `with-title`. Defaults to `true`.
+- **Downloads**: show or hide the button that downloads the dashboard as a PDF, plus the download buttons on each card's results, with `with-downloads`. Defaults to `false`, so set it to `true` if you want people to be able to download results. Changing it requires a [Pro](https://www.metabase.com/product/pro) or [Enterprise](https://www.metabase.com/product/enterprise) plan.
+
+To set the height, style the `<metabase-dashboard>` element with CSS. The element renders as a block, and the embed fills it:
+
+```html
+<style>
+ metabase-dashboard {
+ height: 800px;
+ }
+</style>
+
+<metabase-dashboard dashboard-id="1"></metabase-dashboard>
+```
+
+The embed won't render shorter than 600 pixels, no matter which height you set.
+
+### React SDK dashboard appearance
+
+- **Title**: show or hide the dashboard title with `withTitle`. Defaults to `true`.
+- **Card titles**: show or hide the title on each card with `withCardTitle`.
+- **Downloads**: show or hide the button that downloads the dashboard as a PDF, plus the download buttons on each card's results, with `withDownloads`. Defaults to `false`, so set it to `true` if you want people to be able to download results.
+
+Dashboard components fill the height of their container (`min-height: 100%`). Override that with the `style` or `className` props:
+
+```tsx
+{% include_file "{{ dirname }}/sdk/snippets/dashboards/custom-height.tsx" snippet="example" %}
+```
+
+### Theme an embedded dashboard
+
+Set a light or dark preset, or (on Pro/Enterprise) customize colors and fonts. Web components take the theme in [`defineMetabaseConfig`](./appearance.md#add-an-advanced-theme-to-your-embed); the SDK takes it from [`defineMetabaseTheme`](./appearance.md#reuse-a-saved-theme-in-the-sdk) on `MetabaseProvider`. The theme object itself is the same either way.
+
+The `dashboard` component in the theme has its own overrides:
+
+```js
+{
+ components: {
+ dashboard: {
+ // Background color for all dashboards
+ backgroundColor: "#2F3640",
+
+ // Border color of the dashboard grid, shown only when editing dashboards
+ gridBorderColor: "#EEECEC",
+
+ card: {
+ // Background color for all dashboard cards
+ backgroundColor: "#2D2D30",
+
+ // Apply a border color instead of shadow for dashboard cards
+ border: "1px solid #EEECEC",
+ },
+ },
+ },
+}
+```
+
+Colors set in a card's visualization settings override theme colors. See also [appearance](./appearance.md).
+
+### Remove the "Powered by Metabase" banner
+
+On the OSS and Starter plans, Metabase adds a "Powered by Metabase" banner to guest embeds. See [Removing the "Powered by Metabase" banner](./guest-embedding.md#removing-the-powered-by-metabase-banner).
+
+## Further reading
+
+- [Dashboard component reference](./dashboard-reference.md)
+- [Embed a chart](./chart.md)
+- [Embed the query builder](./query-builder.md)
+- [Appearance](./appearance.md)
+- [Modular embedding parameters](./parameters.md)
+- [Translating embeds](./translations.md)
+- [Guest embeds](./guest-embedding.md)
+- [Authentication](./authentication.md)
+- [Modular embedding SDK](./sdk/introduction.md)
+- [AI chat](./sdk/ai-chat.md)
diff --git a/docs/embedding/guest-embedding.md b/docs/embedding/guest-embedding.md
index c3f749f8783..07d5cef9f68 100644
--- a/docs/embedding/guest-embedding.md
+++ b/docs/embedding/guest-embedding.md
@@ -75,7 +75,7 @@ Then add the component for the item you want to embed:
<metabase-question token="YOUR_JWT_TOKEN"></metabase-question>
```
-> Never hardcode JWT tokens directly in your HTML. Always fetch the token from your backend and pass the token to the web component programmatically.
+> Don't paste a fixed JWT into your HTML and leave it there. Tokens expire, so that embed will stop working. Either sign a fresh token on your server for each page load and render it into the `token` attribute, or set [`guestEmbedProviderUri`](#refreshing-or-initializing-the-jwt-from-your-server) and let the embed fetch and refresh its own token.
### Server-side code
@@ -95,7 +95,7 @@ const payload = {
const token = jwt.sign(payload, METABASE_SECRET_KEY);
```
-Replace `YOUR_METABASE_SECRET_KEY` with your [embedding secret key](#regenerating-the-embedding-secret-key).
+Replace `YOUR_METABASE_SECRET_KEY` with your [embedding secret key](#regenerating-the-embedding-secret-key). These examples use sequential IDs — the number in the item's URL. On Pro and Enterprise plans, you can use [entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; they stay the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production.
### Component attributes
@@ -177,10 +177,8 @@ You set default parameters on the client side with the `initial-parameters` key.
</script>
<!--
-THIS IS THE EXAMPLE!
-NEVER HARDCODE THIS JWT TOKEN DIRECTLY IN YOUR HTML!
-
-Fetch the JWT token from your backend and programmatically pass it to the 'metabase-dashboard'.
+This token is a placeholder. Don't paste a fixed JWT into your HTML: sign a
+fresh one on your server for each page load, or use guestEmbedProviderUri.
-->
<metabase-dashboard
token="YOUR SIGNED TOKEN"
@@ -242,8 +240,8 @@ The parameter is set by the JWT:
</script>
<!--
-IMPORTANT: Never hardcode JWT tokens directly in your HTML!
-Fetch the token from your backend and pass it to the component programmatically.
+This token is a placeholder. Don't paste a fixed JWT into your HTML: sign a
+fresh one on your server for each page load, or use guestEmbedProviderUri.
-->
<metabase-dashboard
token="YOUR_JWT_TOKEN"
@@ -310,6 +308,8 @@ Because Metabase doesn't render locked parameters as filter widgets, you can use
When the end-user changes a value in your custom widget, re-sign a new JWT on your server with the updated `params` and swap it onto the web component's `token` attribute. The embed will re-request the data with the new locked value.
+Render an initial token on the component for this flow, rather than letting [`guestEmbedProviderUri`](#refreshing-or-initializing-the-jwt-from-your-server) supply the first one. An embed that starts without a token fetches one from your endpoint on load, and that token would overwrite whatever your widget had just set.
+
## Refreshing or initializing the JWT from your server
JWTs that you sign for guest embeds have an expiration (`exp`). Once a token expires, the embed can't load fresh data, and any filter selections the viewer made will reset on the next request. To keep the embed alive without reloading the page, you can configure a guest token endpoint on your server to hand out fresh JWTs on demand.
@@ -345,11 +345,11 @@ Request:
}
```
-| Field | Description |
-| --------------- | ------------------------------------------------------------------------- |
-| `entityType` | `"dashboard"` or `"question"`. |
-| `entityId` | The ID of the dashboard or question being embedded. |
-| `customContext` | Optional. The string or object you set on the `custom-context` attribute. |
+| Field | Description |
+| --------------- | ----------------------------------------------------------------------------------- |
+| `entityType` | `"dashboard"` or `"question"`. |
+| `entityId` | The ID of the dashboard or question being embedded, as you set it on the component. |
+| `customContext` | Optional. The string or object you set on the `custom-context` attribute. |
Response: a JSON object with a single `jwt` field:
@@ -398,6 +398,13 @@ app.post("/api/metabase-guest-token", (req, res) => {
const { entityType, entityId, customContext } = req.body;
+ // Authorize the request. The browser picks the entityType and entityId, so
+ // check them against your own rule before signing for them.
+ // This is just an example
+ if (!userCanView(user, entityType, entityId)) {
+ return res.status(403).json({ error: "Not allowed" });
+ }
+
const payload = {
resource: { [entityType]: entityId },
params: paramsFor(user, customContext),
@@ -411,6 +418,7 @@ app.post("/api/metabase-guest-token", (req, res) => {
Because the embed's request includes your app's session cookie, your endpoint can:
- Refuse to issue a JWT (with a `403`) for visitors who aren't signed in to your app.
+- Refuse to issue a JWT for a dashboard or question that this visitor shouldn't see. The `entityType` and `entityId` arrive from the browser, so an endpoint that signs them unchecked will give any signed-in visitor a token for any published item.
- Compute different `params` (i.e., locked filter values) per visitor.
### Sending custom context
@@ -464,7 +472,7 @@ Admins can find a list of embedded items in **Admin > Embedding** (on Pro and En
![Powered by Metabase](./images/powered-by-metabase.png)
-The banner appears on guest embeds created with Metabase's open-source version. To remove the banner, you'll need to upgrade to a [Pro](https://www.metabase.com/product/pro) or [Enterprise](https://www.metabase.com/product/enterprise) plan.
+Metabase adds the banner to guest embeds (both charts and dashboards) on the OSS and Starter plans. To remove the banner, upgrade to a [Pro](https://www.metabase.com/product/pro) or [Enterprise](https://www.metabase.com/product/enterprise) plan.
## Regenerating the embedding secret key
diff --git a/docs/embedding/images/editabledashboard.png b/docs/embedding/images/editabledashboard.png
new file mode 100644
index 00000000000..8772e14cadf
Binary files /dev/null and b/docs/embedding/images/editabledashboard.png differ
diff --git a/docs/embedding/images/embedded-collection-browser.png b/docs/embedding/images/embedded-collection-browser.png
new file mode 100644
index 00000000000..1d8a2560b3f
Binary files /dev/null and b/docs/embedding/images/embedded-collection-browser.png differ
diff --git a/docs/embedding/images/embedded-dashboard.png b/docs/embedding/images/embedded-dashboard.png
new file mode 100644
index 00000000000..f4eb742282d
Binary files /dev/null and b/docs/embedding/images/embedded-dashboard.png differ
diff --git a/docs/embedding/introduction.md b/docs/embedding/introduction.md
index 360a1055523..89615e17ef4 100644
--- a/docs/embedding/introduction.md
+++ b/docs/embedding/introduction.md
@@ -49,7 +49,7 @@ All SSO options require a Pro or Enterprise plan.
| [Query builder](../questions/query-builder/editor.md) | ✅ | ❌ |
| [SQL editor](../questions/native-editor/writing-sql.md) | ✅ | ❌ |
| [AI chat](./sdk/ai-chat.md) | ✅ | ❌ |
-| [Collection browser](./sdk/collections.md) | ✅ | ❌ |
+| [Collection browser](./browser.md) | ✅ | ❌ |
| Advanced [Tenant](./tenants.md) and [permissions](../permissions/embedding.md) management | ✅ | ❌ |
| [Advanced theming](./appearance.md) | ✅ | ❌ |
| [Custom visualizations](./custom-visualizations.md) | ✅ | ❌ |
diff --git a/docs/embedding/modular-embedding.md b/docs/embedding/modular-embedding.md
index 6821daad9f4..4677f34cc44 100644
--- a/docs/embedding/modular-embedding.md
+++ b/docs/embedding/modular-embedding.md
@@ -140,6 +140,8 @@ Here's an example snippet:
<metabase-dashboard dashboard-id="2" with-title="false"></metabase-dashboard>
```
+These examples use sequential IDs — the number in the item's URL. On Pro and Enterprise plans, you can use [entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; they stay the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production.
+
Note the `defer` attribute and the reference to your Metabase URL in the script that loads `embed.js` library.
If you're embedding multiple components in a single page, you only need to include the `<script>` tags once globally.
@@ -172,7 +174,7 @@ When you're creating a new embed using **Admin > Embedding > Setup guide > Embed
- **Show title**: what it says on the tin.
-- **Allow editing dashboards and questions**: lets people create and edit dashboards or questions in the current collection, including both visual and native (SQL) questions. When disabled, they can still perform actions like filter, summarize, and drill-through, but won't be able to save results.
+- **Allow editing dashboards and questions**: lets people create and edit dashboards or questions in the current collection, including both visual and native (SQL) questions. When disabled, they can still perform actions like filter, summarize, and drill-through, but won't be able to save results. This option only shows up when you're embedding a collection browser; checking it sets `read-only="false"` on `<metabase-browser>`. There's no equivalent attribute on `<metabase-dashboard>`, so see [Web component editable dashboard](./dashboard.md#web-component-editable-dashboard) for how to embed an editable dashboard.
- **Allow alerts**: lets people set up [alerts](../questions/alerts.md) on embedded questions. Requires [email setup](../configuring-metabase/email.md). Only for authenticated (SSO) question embeds.
diff --git a/docs/embedding/parameters.md b/docs/embedding/parameters.md
index 6877a1c6654..b2771c3c71b 100644
--- a/docs/embedding/parameters.md
+++ b/docs/embedding/parameters.md
@@ -7,7 +7,7 @@ summary: Pass parameter values to embedded dashboards and SQL questions in modul
This page covers how to pass parameter values to embedded dashboards and SQL questions.
-The props and attributes here set values that whoever's viewing the embed can still change. To set a value your app controls and nobody can see or change, use a [locked parameter](./guest-embedding.md#locked-parameters) on a guest embed, or [data permissions](../permissions/embedding.md) on an SSO embed. See [Control parameters from your app](./chart.md#control-parameters-from-your-app).
+The props and attributes here set values that whoever's viewing the embed can still change. To set a value your app controls and nobody can see or change, use a [locked parameter](./guest-embedding.md#locked-parameters) on a guest embed, or [data permissions](../permissions/embedding.md) on an SSO embed.
## Modular embedding SDK (React)
@@ -35,7 +35,6 @@ Push values from your app, and observe every applied change via `onParametersCha
`onParametersChange` receives the [dashboard parameter change payload](#dashboard-parameter-change-payload).
-
> Don't combine `initialParameters` and `parameters` - pick one. For controlled behavior, only use `parameters`.
### Pass parameters to SQL questions
@@ -86,6 +85,8 @@ Set values on mount via attributes. The component reads them once on load and ig
></metabase-question>
```
+These examples use sequential IDs — the number in the item's URL. On Pro and Enterprise plans, you can use [entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; they stay the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production.
+
Attributes carry JSON. Pass an object whose keys are parameter slugs (dashboards) or SQL variable names (questions). See [How parameter values are resolved](#how-parameter-values-are-resolved) for null / missing-slug semantics.
#### Push values at runtime with `parameters` / `sqlParameters`
@@ -179,3 +180,13 @@ Delivered to `onSqlParametersChange` (SDK) and as `event.detail` for the `sql-pa
- `initial-state` - first applied state, fired once per question load.
- `manual-change` - user edited parameters in UI.
- `auto-change` - in the case of auto-updates, e.g. to pass normalized values back to parent.
+
+## Hide a dashboard filter
+
+To hide a filter from the dashboard's UI, use the [`hidden-parameters`](./dashboard-reference.md#web-component-metabase-dashboard-attributes) attribute (web component) or the `hiddenParameters` prop (SDK).
+
+Hiding filters can be useful when you're embedding a dashboard with SSO authentication, where every filter on the dashboard shows up by default. On a [guest embed](./guest-embedding.md), a filter that you haven't set to **Editable** or **Locked** is already hidden, so there's usually nothing left to hide.
+
+Hiding a filter declutters the UI; it doesn't restrict what people can query. Setting a value with `initial-parameters` and then hiding the widget isn't a secure way to filter data, because your app sets that value in the browser.
+
+To control a value that people can't see or change, use a [locked parameter](./guest-embedding.md#locked-parameters) on a guest embed, or [data permissions](../permissions/embedding.md) on an SSO embed.
diff --git a/docs/embedding/query-builder.md b/docs/embedding/query-builder.md
index 13ae64ddf75..27d253e4994 100644
--- a/docs/embedding/query-builder.md
+++ b/docs/embedding/query-builder.md
@@ -72,6 +72,8 @@ With a web component, turn saving on with `is-save-enabled="true"`. `target-coll
></metabase-question>
```
+These examples use sequential IDs — the number in the item's URL. On Pro and Enterprise plans, you can use [entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; they stay the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production.
+
### Saving with the React SDK
With the SDK, saving is already on, so `targetCollection` is all you need. Setting `targetCollection` also hides the collection picker, so nobody has to decide where their question goes.
@@ -80,12 +82,14 @@ For the `isSaveEnabled`, `onBeforeSave`, and `onSave` props, check out [Let peop
## Customize the query builder's layout
-With the SDK, you can build your own layout out of the namespaced components inside `InteractiveQuestion`, like `<InteractiveQuestion.Editor />`. See [InteractiveQuestion components](./question-reference.md#interactivequestion-components).
+With the SDK, you can build your own layout out of the namespaced components inside `InteractiveQuestion`, like `<InteractiveQuestion.Editor />`. See [InteractiveQuestion components](./question-reference.md#react-sdk-interactivequestion-components).
## Further reading
- [Embed a chart](./chart.md)
- [Question component reference](./question-reference.md)
+- [Embed a dashboard](./dashboard.md)
+- [Dashboard component reference](./dashboard-reference.md)
- [Modular embedding](./modular-embedding.md)
- [Modular embedding SDK](./sdk/introduction.md)
- [Modular embedding components](./components.md)
diff --git a/docs/embedding/question-reference.md b/docs/embedding/question-reference.md
index 423115986e3..9956c831c2e 100644
--- a/docs/embedding/question-reference.md
+++ b/docs/embedding/question-reference.md
@@ -9,26 +9,44 @@ Reference material for embedding a chart or a query editor: the attributes you c
For how to set all this up, check out [Embed a chart](./chart.md) and [Embed the query builder](./query-builder.md).
-## `metabase-question` web component attributes
+## Web component `metabase-question` attributes
-These attributes apply to the `<metabase-question>` web component. For the SDK, see [`StaticQuestion` props](#staticquestion-props) and [`InteractiveQuestion` props](#interactivequestion-props).
+These attributes apply to the `<metabase-question>` web component. For the SDK, see [`StaticQuestion` props](#react-sdk-staticquestion-props) and [`InteractiveQuestion` props](#react-sdk-interactivequestion-props).
{% include_file "{{ dirname }}/eajs/snippets/MetabaseQuestionAttributes.md" snippet="properties" %}
-## `StaticQuestion` props
+Depending on the framework you're using, you may need to stringify attributes before passing them to the component. And if you surround an attribute's value with double quotes, use single quotes inside it:
+
+```html
+<metabase-question
+ question-id="1"
+ initial-sql-parameters="{ 'productId': '42' }"
+ hidden-parameters="['productId']"
+></metabase-question>
+```
+
+These examples use sequential IDs — the number in the item's URL. On Pro and Enterprise plans, you can use [entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; they stay the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production.
+
+## React SDK `StaticQuestion` props
{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
`StaticQuestion` embeds a [view-only chart](./chart.md#embed-a-view-only-chart).
+- [Component](./sdk/api/StaticQuestion.html)
+- [Props](./sdk/api/StaticQuestionProps.html)
+
{% include_file "{{ dirname }}/sdk/api/snippets/StaticQuestionProps.md" snippet="properties" %}
-## `InteractiveQuestion` props
+## React SDK `InteractiveQuestion` props
{% include plans-blockquote.html feature="Interactive charts" convert_pro_link_to_embedding=true is_plural=true %}
`InteractiveQuestion` embeds an [interactive chart](./chart.md#embed-an-interactive-chart) or [a query editor](./query-builder.md).
+- [Component](./sdk/api/InteractiveQuestion.html)
+- [Props](./sdk/api/InteractiveQuestionProps.html)
+
{% include_file "{{ dirname }}/sdk/api/snippets/InteractiveQuestionProps.md" snippet="properties" %}
## Customize the layout of an interactive chart
@@ -45,7 +63,7 @@ To build your own layout, use namespaced components inside `InteractiveQuestion`
{% include_file "{{ dirname }}/sdk/snippets/questions/customize-interactive-question.tsx" snippet="example-customized-interactive-question" %}
```
-## `InteractiveQuestion` components
+## React SDK `InteractiveQuestion` components
These components are available via the `InteractiveQuestion` namespace (like `<InteractiveQuestion.Filter />`). Use them to [customize the layout](#customize-the-layout-of-an-interactive-chart) of an interactive question.
@@ -79,6 +97,7 @@ These components are available via the `InteractiveQuestion` namespace (like `<I
- [Embed a chart](./chart.md)
- [Embed the query builder](./query-builder.md)
+- [Dashboard component reference](./dashboard-reference.md)
- [Modular embedding components](./components.md)
- [Modular embedding parameters](./parameters.md)
- [Appearance](./appearance.md)
diff --git a/docs/embedding/sdk/collections.md b/docs/embedding/sdk/collections.md
deleted file mode 100644
index 81c23cbc746..00000000000
--- a/docs/embedding/sdk/collections.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-title: Modular embedding SDK - collections
-summary: Embed Metabase collection browser in your application using the MetabaseProvider SDK component.
----
-
-# Modular embedding SDK - collections
-
-{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
-
-## Embedding a collection browser
-
-You can embed Metabase's collection browser so that people can explore items in your Metabase from your application.
-
-### `CollectionBrowser`
-
-#### API Reference
-
-- [Component](./api/CollectionBrowser.html)
-- [Props](./api/CollectionBrowserProps.html)
-
-#### Example
-
-```tsx
-{% include_file "{{ dirname }}/snippets/collections/collection-browser.tsx" %}
-```
-
-#### Props
-
-{% include_file "{{ dirname }}/api/snippets/CollectionBrowserProps.md" snippet="properties" %}
-
-## Hide the collection picker and hard code the collection you want people to save stuff to
-
-With static questions, you set a specific collection as the collection people can save items to, so that they don't have to bother picking a collection. To hard-code a collection:
-
-1. Set `isSaveEnabled` to true.
-2. Set `targetCollection` to the collection ID you want people to save items to.
-
-For more options, see [Let people save their changes](../chart.md#let-people-save-their-changes).
diff --git a/docs/embedding/sdk/dashboards.md b/docs/embedding/sdk/dashboards.md
deleted file mode 100644
index 8f97811fb75..00000000000
--- a/docs/embedding/sdk/dashboards.md
+++ /dev/null
@@ -1,181 +0,0 @@
----
-title: "Modular embedding SDK - dashboards"
-summary: Embed static or interactive Metabase dashboards using the Modular embedding SDK. Customize dashboard layout, drill-through, and add custom actions.
----
-
-# Modular embedding SDK - dashboards
-
-{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true %}
-
-You can embed an interactive, editable, or static dashboard.
-
-**Keep in mind that embedding multiple instances of dashboards on the same page is not yet supported.**
-
-## Embedding a dashboard
-
-You can embed a dashboard using one of the dashboard components:
-
-### `StaticDashboard`
-
-A lightweight dashboard component. Use this component when you want to display results without letting people interact with the data.
-
-#### API Reference
-
-- [Component](./api/StaticDashboard.html)
-- [Props](./api/StaticDashboardProps.html)
-
-#### Props
-
-{% include_file "{{ dirname }}/api/snippets/StaticDashboardProps.md" snippet="properties" %}
-
-### `InteractiveDashboard`
-
-A dashboard component with drill downs, click behaviors, and the ability to view and click into questions. Use this component when you want to allow people to explore their data.
-
-#### API Reference
-
-- [Component](./api/InteractiveDashboard.html)
-- [Props](./api/InteractiveDashboardProps.html)
-
-#### Props
-
-{% include_file "{{ dirname }}/api/snippets/InteractiveDashboardProps.md" snippet="properties" %}
-
-### `EditableDashboard`
-
-A dashboard component with the features available in the `InteractiveDashboard` component, as well as the ability to add and update questions, layout, and content within your dashboard. Use this component when you want to give people the ability to modify your dashboards, for example in an admin panel in your app.
-
-#### API Reference
-
-- [Component](./api/EditableDashboard.html)
-- [Props](./api/EditableDashboardProps.html)
-
-#### Props
-
-{% include_file "{{ dirname }}/api/snippets/EditableDashboardProps.md" snippet="properties" %}
-
-## Example embedded dashboard with `InteractiveDashboard` component
-
-```typescript
-{% include_file "{{ dirname }}/snippets/dashboards/interactive-dashboard.tsx" %}
-```
-
-## Pass parameter values to a dashboard
-
-See [Modular embedding parameters](../parameters.md#pass-parameter-values-to-a-dashboard).
-
-## Customizing dashboard height
-
-By default, dashboard components take full page height (100vh). You can override this with custom styles passed via `style` or `className` props.
-
-```tsx
-{% include_file "{{ dirname }}/snippets/dashboards/custom-height.tsx" snippet="example" %}
-```
-
-## Customizing drill-through question layout
-
-Drilling through or clicking on a question card in the dashboard will take you to the question view with the [default layout](../question-reference.md#customize-the-layout-of-an-interactive-chart) for interactive questions.
-
-To customize the question layout, pass a `renderDrillThroughQuestion` prop to the `InteractiveDashboard` component, with the custom view as the child component.
-
-```typescript
-{% include_file "{{ dirname }}/snippets/dashboards/custom-drill-through-question-layout.tsx" snippet="example-1" %}
-
-{% include_file "{{ dirname }}/snippets/dashboards/custom-drill-through-question-layout.tsx" snippet="example-2" %}
-```
-
-The `questionView` prop accepts a React component that will be rendered in the question view, which you can build with namespaced components within the `InteractiveQuestion` component. See [customize the layout](../question-reference.md#customize-the-layout-of-an-interactive-chart).
-
-## Dashboard plugins
-
-### `dashboardCardMenu`
-
-This plugin allows you to add, remove, and modify the custom actions on the overflow menu of dashboard cards. The plugin appears as a dropdown menu on the top right corner of the card.
-
-The plugin's default configuration looks like this:
-
-```typescript
-{% include_file "{{ dirname }}/snippets/dashboards/plugins.tsx" snippet="example-base-1" %}
-```
-
-`dashboardCardMenu`: can be used in the InteractiveDashboard like this:
-
-```typescript
-{% include_file "{{ dirname }}/snippets/dashboards/plugins.tsx" snippet="example-base-2" %}
-```
-
-#### Enabling/disabling default actions
-
-To remove the download button from the dashcard menu, set `withDownloads` to `false`. To remove the edit link from the dashcard menu, set `withEditLink` to `false`.
-
-```typescript
-{% include_file "{{ dirname }}/snippets/dashboards/plugins.tsx" snippet="example-default-actions" %}
-```
-
-#### Adding custom actions to the existing menu:
-
-You can add custom actions to the dashcard menu by adding an object to the `customItems` array. Each element can either be an object or a function that takes in the dashcard's question, and outputs a list of custom items in the form of:
-
-```typescript
-{% include_file "{{ dirname }}/snippets/dashboards/plugins.tsx" snippet="example-custom-action-type" %}
-```
-
-Here's an example:
-
-```typescript
-{% include_file "{{ dirname }}/snippets/dashboards/plugins.tsx" snippet="example-custom-actions" %}
-```
-
-#### Replacing the existing menu with your own component
-
-If you want to replace the existing menu with your own component, you can do so by providing a function that returns a React component. This function also can receive the question as an argument.
-
-```typescript
-{% include_file "{{ dirname }}/snippets/dashboards/plugins.tsx" snippet="example-custom-actions-menu" %}
-```
-
-### `mapQuestionClickActions`
-
-You can customize what happens when people click on a data point on a dashboard with the `mapQuestionClickActions` plugin. See [mapQuestionClickActions](../chart.md#customize-what-happens-when-someone-clicks-on-a-chart).
-
-## Creating dashboards
-
-Creating a dashboard could be done with `useCreateDashboardApi` hook or `CreateDashboardModal` component.
-
-### `useCreateDashboardApi`
-
-Use this hook if you'd like to have total control over the UI and settings.
-
-Until the SDK is fully loaded and initialized, the hook returns `null`.
-
-#### API Reference
-
-- [Hook](./api/useCreateDashboardApi.html)
-- [Options](./api/CreateDashboardValues.html)
-
-#### Example
-
-```typescript
-{% include_file "{{ dirname }}/snippets/dashboards/create-dashboard.tsx" snippet="example-hook" %}
-```
-
-#### Options
-
-{% include_file "{{ dirname }}/api/snippets/CreateDashboardValues.md" snippet="properties" %}
-
-### `CreateDashboardModal`
-
-#### API Reference
-
-- [Component](./api/CreateDashboardModal.html)
-- [Props](./api/CreateDashboardModalProps.html)
-
-#### Example
-
-```typescript
-{% include_file "{{ dirname }}/snippets/dashboards/create-dashboard.tsx" snippet="example-component" %}
-```
-
-#### Props
-
-{% include_file "{{ dirname }}/api/snippets/CreateDashboardModalProps.md" snippet="properties" %}
diff --git a/docs/embedding/sdk/introduction.md b/docs/embedding/sdk/introduction.md
index 09aec59b09b..f4922ec836a 100644
--- a/docs/embedding/sdk/introduction.md
+++ b/docs/embedding/sdk/introduction.md
@@ -106,10 +106,10 @@ Start with one of the quickstarts, then see these pages for more info on compone
- [Authentication](../authentication.md)
- [Embed a chart](../chart.md)
- [AI chat](./ai-chat.md)
-- [Dashboards](./dashboards.md)
+- [Embed a dashboard](../dashboard.md)
- [Actions](./actions.md)
- [Appearance](../appearance.md)
-- [Collections](./collections.md)
+- [Embed a collection browser](../browser.md)
- [Custom visualizations](../custom-visualizations.md)
- [Plugins](./plugins.md)
- [Config](./config.md)
diff --git a/docs/embedding/sdk/plugins.md b/docs/embedding/sdk/plugins.md
index fec0125c2b3..bd57ebc0589 100644
--- a/docs/embedding/sdk/plugins.md
+++ b/docs/embedding/sdk/plugins.md
@@ -30,7 +30,7 @@ To use a plugin on a per-component basis, pass the plugin as a prop to the compo
See docs for specific components:
- [Question plugins](../chart.md#customize-what-happens-when-someone-clicks-on-a-chart)
-- [Dashboard plugins](./dashboards.md#dashboard-plugins)
+- [Dashboard plugins](../dashboard.md#customize-the-menu-on-dashboard-cards-react-sdk-only)
## Global plugins
@@ -69,4 +69,4 @@ The plugins `getNoDataIllustration` and `getNoObjectIllustration` can only be us
## Further reading
- [Question plugins](../chart.md#customize-what-happens-when-someone-clicks-on-a-chart)
-- [Dashboard plugins](./dashboards.md#dashboard-plugins)
+- [Dashboard plugins](../dashboard.md#customize-the-menu-on-dashboard-cards-react-sdk-only)
diff --git a/docs/embedding/sdk/snippets/collections/collection-browser-click.tsx b/docs/embedding/sdk/snippets/collections/collection-browser-click.tsx
new file mode 100644
index 00000000000..27b552935c0
--- /dev/null
+++ b/docs/embedding/sdk/snippets/collections/collection-browser-click.tsx
@@ -0,0 +1,32 @@
+import React, { useState } from "react";
+import {
+ CollectionBrowser,
+ InteractiveDashboard,
+ InteractiveQuestion,
+ type MetabaseCollectionItem,
+} from "@metabase/embedding-sdk-react";
+
+export default function BrowseAndOpen() {
+ const [dashboardId, setDashboardId] = useState<number | null>(null);
+ const [questionId, setQuestionId] = useState<number | null>(null);
+
+ const handleClick = (item: MetabaseCollectionItem) => {
+ // Metabase's internal names for these differ from what people see:
+ // a question is a "card", and a model is a "dataset".
+ if (item.model === "dashboard") {
+ setDashboardId(item.id as number);
+ } else if (item.model === "card" || item.model === "dataset") {
+ setQuestionId(item.id as number);
+ }
+ };
+
+ if (dashboardId) {
+ return <InteractiveDashboard dashboardId={dashboardId} />;
+ }
+
+ if (questionId) {
+ return <InteractiveQuestion questionId={questionId} />;
+ }
+
+ return <CollectionBrowser collectionId="personal" onClick={handleClick} />;
+}
diff --git a/docs/embedding/sdk/snippets/collections/collection-browser.tsx b/docs/embedding/sdk/snippets/collections/collection-browser.tsx
index 4b09f156385..badb4a7eecd 100644
--- a/docs/embedding/sdk/snippets/collections/collection-browser.tsx
+++ b/docs/embedding/sdk/snippets/collections/collection-browser.tsx
@@ -1,19 +1,24 @@
import React from "react";
-import { CollectionBrowser } from "@metabase/embedding-sdk-react";
+import {
+ CollectionBrowser,
+ MetabaseProvider,
+ defineMetabaseAuthConfig,
+} from "@metabase/embedding-sdk-react";
+
+const authConfig = defineMetabaseAuthConfig({
+ metabaseInstanceUrl: "https://your-metabase.example.com",
+});
export default function App() {
const collectionId = 123; // This is the collection ID you want to browse
- const handleItemClick = item => {
- console.log("Clicked item:", item);
- };
return (
- <CollectionBrowser
- collectionId={collectionId}
- onClick={handleItemClick}
- pageSize={10}
- // Define the collection item types you want to be visible
- visibleEntityTypes={["dashboard", "question", "collection"]}
- />
+ <MetabaseProvider authConfig={authConfig}>
+ <CollectionBrowser
+ collectionId={collectionId}
+ pageSize={10}
+ visibleEntityTypes={["dashboard", "question", "collection"]}
+ />
+ </MetabaseProvider>
);
}
diff --git a/docs/embedding/sdk/snippets/dashboards/dashboard-auto-refresh.tsx b/docs/embedding/sdk/snippets/dashboards/dashboard-auto-refresh.tsx
new file mode 100644
index 00000000000..bc1eedbca3c
--- /dev/null
+++ b/docs/embedding/sdk/snippets/dashboards/dashboard-auto-refresh.tsx
@@ -0,0 +1,9 @@
+import { InteractiveDashboard } from "@metabase/embedding-sdk-react";
+
+const dashboardId = 1;
+
+const Example = () => (
+ // [<snippet example>]
+ <InteractiveDashboard dashboardId={dashboardId} autoRefreshInterval={60} />
+ // [<endsnippet example>]
+);
diff --git a/docs/embedding/sdk/snippets/dashboards/dashboard-subscriptions.tsx b/docs/embedding/sdk/snippets/dashboards/dashboard-subscriptions.tsx
new file mode 100644
index 00000000000..57adca04694
--- /dev/null
+++ b/docs/embedding/sdk/snippets/dashboards/dashboard-subscriptions.tsx
@@ -0,0 +1,9 @@
+import { InteractiveDashboard } from "@metabase/embedding-sdk-react";
+
+const dashboardId = 1;
+
+const Example = () => (
+ // [<snippet example>]
+ <InteractiveDashboard dashboardId={dashboardId} withSubscriptions />
+ // [<endsnippet example>]
+);
diff --git a/docs/embedding/sdk/snippets/dashboards/editable-dashboard-data-picker.tsx b/docs/embedding/sdk/snippets/dashboards/editable-dashboard-data-picker.tsx
new file mode 100644
index 00000000000..30534295762
--- /dev/null
+++ b/docs/embedding/sdk/snippets/dashboards/editable-dashboard-data-picker.tsx
@@ -0,0 +1,13 @@
+import React from "react";
+import { EditableDashboard } from "@metabase/embedding-sdk-react";
+
+export default function TablesOnlyDashboard() {
+ const dashboardId = 1; // This is the dashboard ID you want to embed
+
+ return (
+ <EditableDashboard
+ dashboardId={dashboardId}
+ dataPickerProps={{ entityTypes: ["table"] }}
+ />
+ );
+}
diff --git a/docs/embedding/sdk/snippets/dashboards/editable-dashboard.tsx b/docs/embedding/sdk/snippets/dashboards/editable-dashboard.tsx
new file mode 100644
index 00000000000..0b2e6c44cb4
--- /dev/null
+++ b/docs/embedding/sdk/snippets/dashboards/editable-dashboard.tsx
@@ -0,0 +1,20 @@
+import React from "react";
+import {
+ EditableDashboard,
+ MetabaseProvider,
+ defineMetabaseAuthConfig,
+} from "@metabase/embedding-sdk-react";
+
+const authConfig = defineMetabaseAuthConfig({
+ metabaseInstanceUrl: "https://your-metabase.example.com",
+});
+
+export default function App() {
+ const dashboardId = 1; // This is the dashboard ID you want to embed
+
+ return (
+ <MetabaseProvider authConfig={authConfig}>
+ <EditableDashboard dashboardId={dashboardId} />
+ </MetabaseProvider>
+ );
+}
diff --git a/docs/embedding/sdk/snippets/dashboards/plugins.tsx b/docs/embedding/sdk/snippets/dashboards/plugins.tsx
index 439e80a4893..b98e50f05ac 100644
--- a/docs/embedding/sdk/snippets/dashboards/plugins.tsx
+++ b/docs/embedding/sdk/snippets/dashboards/plugins.tsx
@@ -5,29 +5,17 @@ import {
const dashboardId = 1;
-const ExampleBase1 = () => {
- // [<snippet example-base-1>]
- const plugins = {
- dashboard: {
- dashboardCardMenu: {
- withDownloads: true,
- withEditLink: true,
- customItems: [],
- },
- },
- };
- // [<endsnippet example-base-1>]
-
- return <InteractiveDashboard dashboardId={dashboardId} plugins={plugins} />;
-};
-
const ExampleBase2 = () => (
// [<snippet example-base-2>]
<InteractiveDashboard
dashboardId={1}
plugins={{
dashboard: {
- dashboardCardMenu: () => null,
+ dashboardCardMenu: {
+ withDownloads: true,
+ withEditLink: true,
+ customItems: [],
+ },
},
}}
/>
diff --git a/docs/embedding/sdk/snippets/dashboards/static-dashboard.tsx b/docs/embedding/sdk/snippets/dashboards/static-dashboard.tsx
new file mode 100644
index 00000000000..6ec13b91cbf
--- /dev/null
+++ b/docs/embedding/sdk/snippets/dashboards/static-dashboard.tsx
@@ -0,0 +1,20 @@
+import React from "react";
+import {
+ MetabaseProvider,
+ StaticDashboard,
+ defineMetabaseAuthConfig,
+} from "@metabase/embedding-sdk-react";
+
+const authConfig = defineMetabaseAuthConfig({
+ metabaseInstanceUrl: "https://your-metabase.example.com",
+});
+
+export default function App() {
+ const dashboardId = 1; // This is the dashboard ID you want to embed
+
+ return (
+ <MetabaseProvider authConfig={authConfig}>
+ <StaticDashboard dashboardId={dashboardId} withTitle={true} />
+ </MetabaseProvider>
+ );
+}
diff --git a/docs/embedding/sdk/snippets/questions/interactive-question-plugins.tsx b/docs/embedding/sdk/snippets/questions/interactive-question-plugins.tsx
index 62e7331b9fd..1ab323d7463 100644
--- a/docs/embedding/sdk/snippets/questions/interactive-question-plugins.tsx
+++ b/docs/embedding/sdk/snippets/questions/interactive-question-plugins.tsx
@@ -9,7 +9,7 @@ const authConfig = {} as MetabaseAuthConfig;
const Example = () => {
// [<snippet example>]
// You can provide a custom action with your own `onClick` logic.
- const createCustomAction = clicked => ({
+ const createCustomAction = (clicked) => ({
buttonType: "horizontal",
name: "client-custom-action",
section: "custom",
@@ -23,7 +23,7 @@ const Example = () => {
});
// Or customize the appearance of the custom action to suit your need.
- const createCustomActionWithView = clicked => ({
+ const createCustomActionWithView = (clicked) => ({
name: "client-custom-action-2",
section: "custom",
type: "custom",
diff --git a/docs/embedding/start.md b/docs/embedding/start.md
index 2e36db99daa..f4e5ba48487 100644
--- a/docs/embedding/start.md
+++ b/docs/embedding/start.md
@@ -26,6 +26,14 @@ With the Modular embedding SDK, you can embed individual Metabase components wit
Jump to a SDK quickstart with a sample React application.
+### [Embed a dashboard](./dashboard.md)
+
+Embed a dashboard, view-only or interactive, with web components or the React SDK. Let people edit and create dashboards from your app.
+
+### [Dashboard component reference](./dashboard-reference.md)
+
+Every `<metabase-dashboard>` attribute, the `StaticDashboard`, `InteractiveDashboard`, and `EditableDashboard` props, and the `dashboardCardMenu` plugin.
+
### [Embed a chart](./chart.md)
Embed a single chart, view-only or interactive, with web components or the React SDK.
@@ -38,6 +46,14 @@ Embed Metabase's visual query builder or SQL editor, so people can build and sav
Every `<metabase-question>` attribute, the `StaticQuestion` and `InteractiveQuestion` props, and the components you can use to build your own question layout.
+### [Embed a collection browser](./browser.md)
+
+Embed a browsable collection with web components or the React SDK, so people can find and open dashboards and questions themselves.
+
+### [Browser component reference](./browser-reference.md)
+
+Every `<metabase-browser>` attribute and the `CollectionBrowser` props.
+
### [Guest embedding](./guest-embedding.md)
Guest embedding is a secure way to embed charts and dashboards. Guest embeds are view-only; people won't be able to drill-through charts and tables.
diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-options.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-options.cy.spec.ts
index 1ff974336a9..48fc7812237 100644
--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-options.cy.spec.ts
+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-options.cy.spec.ts
@@ -722,7 +722,7 @@ describe(suiteTitle, () => {
cy.findByTestId("behavior-docs-link").should("be.visible");
cy.findByTestId("behavior-docs-link")
.should("have.attr", "href")
- .and("include", "embedding/components.html#question");
+ .and("include", "embedding/question-reference");
cy.findByText("Back").click();
diff --git a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/steps/AppearanceStep/BehaviorCard.tsx b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/steps/AppearanceStep/BehaviorCard.tsx
index 06912413dae..3fb7c4ef90d 100644
--- a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/steps/AppearanceStep/BehaviorCard.tsx
+++ b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/steps/AppearanceStep/BehaviorCard.tsx
@@ -28,9 +28,7 @@ export const BehaviorCard = () => {
const behaviorDocsParams = getBehaviorDocsUrlParams(settings);
// eslint-disable-next-line metabase/no-unconditional-metabase-links-render -- Only admins can see the EmbedJS Wizard
- const { url: behaviorDocsUrl } = useDocsUrl(behaviorDocsParams?.page ?? "", {
- anchor: behaviorDocsParams?.anchor,
- });
+ const { url: behaviorDocsUrl } = useDocsUrl(behaviorDocsParams?.page ?? "");
const behaviorSection = useMemo(() => {
return match(settings)
diff --git a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/utils/get-behavior-docs-url-params.ts b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/utils/get-behavior-docs-url-params.ts
index 733f2283808..0fafe99d206 100644
--- a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/utils/get-behavior-docs-url-params.ts
+++ b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/utils/get-behavior-docs-url-params.ts
@@ -2,7 +2,7 @@ import { match } from "ts-pattern";
import type { SdkIframeEmbedSetupSettings } from "../types";
-export type BehaviorDocsParams = { page: string; anchor?: string } | null;
+export type BehaviorDocsParams = { page: string } | null;
export const getBehaviorDocsUrlParams = (
settings: SdkIframeEmbedSetupSettings,
@@ -11,15 +11,17 @@ export const getBehaviorDocsUrlParams = (
return { page: "embedding/guest-embedding" };
}
- const anchor = match(settings.componentName)
- .with("metabase-question", () => "question")
- .with("metabase-dashboard", () => "dashboard")
- .with("metabase-browser", () => "browser")
+ // Each component's attributes are documented on its own reference page, where
+ // they're the first section.
+ const page = match(settings.componentName)
+ .with("metabase-browser", () => "embedding/browser-reference")
+ .with("metabase-question", () => "embedding/question-reference")
+ .with("metabase-dashboard", () => "embedding/dashboard-reference")
.otherwise(() => null);
- if (!anchor) {
+ if (!page) {
return null;
}
- return { page: "embedding/components", anchor };
+ return { page };
};
diff --git a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/utils/get-behavior-docs-url-params.unit.spec.ts b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/utils/get-behavior-docs-url-params.unit.spec.ts
index 44d6b7a278f..23935cd719b 100644
--- a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/utils/get-behavior-docs-url-params.unit.spec.ts
+++ b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/utils/get-behavior-docs-url-params.unit.spec.ts
@@ -23,22 +23,22 @@ describe("getBehaviorDocsUrlParams", () => {
componentName: "metabase-question",
template: "exploration",
},
- expected: { page: "embedding/components", anchor: "question" },
+ expected: { page: "embedding/question-reference" },
},
{
name: "metabase-question component",
settings: { componentName: "metabase-question", questionId: 1 },
- expected: { page: "embedding/components", anchor: "question" },
+ expected: { page: "embedding/question-reference" },
},
{
name: "metabase-dashboard component",
settings: { componentName: "metabase-dashboard", dashboardId: 1 },
- expected: { page: "embedding/components", anchor: "dashboard" },
+ expected: { page: "embedding/dashboard-reference" },
},
{
name: "metabase-browser component",
settings: { componentName: "metabase-browser" },
- expected: { page: "embedding/components", anchor: "browser" },
+ expected: { page: "embedding/browser-reference" },
},
{
name: "metabase-metabot component",
diff --git a/frontend/src/metabase/embedding/embedding-iframe-sdk/types/modular-embedding.ts b/frontend/src/metabase/embedding/embedding-iframe-sdk/types/modular-embedding.ts
index 07fd8afff2a..301f07ef2ae 100644
--- a/frontend/src/metabase/embedding/embedding-iframe-sdk/types/modular-embedding.ts
+++ b/frontend/src/metabase/embedding/embedding-iframe-sdk/types/modular-embedding.ts
@@ -232,8 +232,10 @@ export interface MetabaseQuestionAttributes {
*/
export interface MetabaseBrowserAttributes {
/**
- * 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.
+ * Which collection to start from. Values: regular ID, entity ID, `"root"` for
+ * the top-level "Our Analytics" collection, `"personal"` for the viewer's
+ * personal collection, or `"tenant"` for the viewer's tenant collection.
+ * People who aren't tenant members get an error for `"tenant"`.
*/
"initial-collection": number | string;