The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
docs - embedding native question (#69762)
Jeff Bruemmer97fa5da0c042
diff --git a/docs/embedding/components.md b/docs/embedding/components.mdindex f3e5f6a90ae..61624a3f67d 100644--- a/docs/embedding/components.md+++ b/docs/embedding/components.md@@ -58,6 +58,17 @@ To render a question (chart):<metabase-question question-id="1"></metabase-question>```+You can also use the question component to create new questions:++- `question-id="new"` — opens the visual query builder.+- `question-id="new-native"` — opens the SQL editor.++For example, to embed the SQL editor:++```html+<metabase-question question-id="new-native"></metabase-question>+```+### Attributes{% include_file "{{ dirname }}/eajs/snippets/MetabaseQuestionAttributes.md" snippet="properties" %}diff --git a/docs/embedding/modular-embedding.md b/docs/embedding/modular-embedding.mdindex b48f576eeb0..7c627cf0427 100644--- a/docs/embedding/modular-embedding.md+++ b/docs/embedding/modular-embedding.md@@ -156,20 +156,19 @@ In addition to this, we consider shared accounts to be unfair usage. Fair usageThe exact customization options you see will depend on which type of entity you're embedding. These are the settings for authenticated embeds available on [Pro](https://www.metabase.com/product/pro) and [Enterprise](https://www.metabase.com/product/enterprise) plans. For guest embeds (OSS and paid), see [guest embedding options](./guest-embedding.md#component-attributes).-When you're creating a new embed using **Admin > Embedding > Setup guide > Embed in your code**, you'll see some or all the following customization options in the interactive creation flow. These options correspond to parameters in [components](./components.md).- **Allow people to drill through on data points**: determines whether people can interact with the chart (or charts on a dashboard). Interactivity includes [drilling down](https://www.metabase.com/learn/metabase-basics/querying-and-dashboards/questions/drill-through) to individual records from aggregated questions, filtering on click, zooming in, etc. Disabling drill-through for an embedded _question_ also disables people's ability to add filters and summaries.- **Allow downloads**. Determines whether people can download question results and save dashboards as PDFs.-- **Allow people to save new questions**. If you embed the query builder but disable this option, people can still do their own explorations, they just won't be able to save them.+- **Allow people to save new questions**. If you embed the query builder (visual or SQL) but disable this option, people can still do their own explorations, they just won't be able to save them.- **Parameters**: for dashboard filters, SQL variables, and time grouping parameters, you can add default values. Default values set here override the default values set at the dashboard or question level. For dashboard filters and parameters, you can choose whether to hide the parameter.- **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. 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.- **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.@@ -189,8 +188,6 @@ To define the configuration that applies to every embed on the page, use the `de- `pluginsConfig` : plugins to customize the behavior of embedded components. Use the `handleLink` function to customize what happens when people click a link in your embedded questions and dashboards. For details on the `handleLink` API, including code examples, see [`handleLink` plugin](./sdk/plugins.md#handlelink).-## AuthenticationFor authentication setup including API keys for local testing, SSO with JWT/SAML, and cross-domain configuration, see [Modular embedding - authentication](./authentication.md).-diff --git a/docs/embedding/sdk/questions.md b/docs/embedding/sdk/questions.mdindex 60b9c23a0b7..260f1ce9712 100644--- a/docs/embedding/sdk/questions.md+++ b/docs/embedding/sdk/questions.md@@ -10,8 +10,7 @@ description: How to embed charts in your app with the Modular embedding SDK.There are different ways you can embed questions:- [Static question](#staticquestion). Embeds a chart. Clicking on the chart doesn't do anything.-- [Interactive question](#interactivequestion). Clicking on the chart gives you the drill-through menu.-- [Query builder](#embedding-the-query-builder-for-creating-new-questions). Embeds the graphical query builder without a pre-defined query.+- [Interactive question](#interactivequestion). Create new questions or edit existing ones with the visual query builder or SQL editor. Clicking on the chart gives you the drill-through menu.## Embedding a question@@ -168,13 +167,19 @@ To prevent people from saving changes to an interactive question, or from saving{% include_file "{{ dirname }}/snippets/questions/disable-question-save.tsx" %}```-## Embedding the query builder for creating new questions+## Create and edit questions with the query builder+The `InteractiveQuestion` component supports three modes:++- `questionId="new"` — opens the visual query builder for creating new questions.+- `questionId="new-native"` — opens the SQL editor for creating new questions.+- A numeric `questionId` (e.g., `questionId={42}`) — embeds an existing question. People can click the edit button to modify it, which opens the appropriate editor (visual or SQL) based on the question type.+### Embed the visual query builder-You can embed the query builder for creating new questions by passing the `questionId="new"` prop to the `InteractiveQuestion` component. You can use the [`children` prop](#customizing-interactive-questions) to customize the layout for creating new questions.+To embed the query builder for creating new questions, pass `questionId="new"` to the `InteractiveQuestion` component. You can use the [`children` prop](#customizing-interactive-questions) to customize the layout.```tsx{% include_file "{{ dirname }}/snippets/questions/new-question.tsx" %}@@ -182,7 +187,7 @@ You can embed the query builder for creating new questions by passing the `quest### Embed the SQL editor-You can also embed the SQL editor to enable people to build questions with SQL by passing `questionId="new-native"` to the `InteractiveQuestion` component:+To embed the SQL editor for creating new questions, pass `questionId="new-native"` to the `InteractiveQuestion` component:```tsx{% include_file "{{ dirname }}/snippets/questions/new-native-question.tsx" %}