Skip to content
Snippets Groups Projects
Unverified Commit b87281c5 authored by Oisin Coveney's avatar Oisin Coveney Committed by GitHub
Browse files

Update README to reflect API changes in Static Dashboard (#43727)

parent 855c840b
Branches
Tags
No related merge requests found
......@@ -248,19 +248,14 @@ const questionId = 1; // This is the question ID you want to embed
After the SDK is configured, you can embed your dashboard using the `StaticDashboard` component.
The API follows the same configuration as that of public dashboard embeddings, which you can read about (here)[https://www.metabase.com/docs/latest/questions/sharing/public-links#public-embed-parameters]
#### Parameters
- **dashboardId**: `number` (required) – The ID of the dashboard. This is the numerical ID when accessing a dashboard link, i.e. `http://localhost:3000/dashboard/1-my-dashboard` where the ID is `1`
- **parameterQueryParams**: `Record<string, string | string[]>` – Query parameters for the dashboard. For a single option, use a `string` value, and use a list of strings for multiple options.
- **bordered**: `boolean` – Whether the dashboard should have a border.
- **titled**: `boolean` – Whether the dashboard should display a title.
- **hideDownloadButton**: `boolean | null` – Whether to hide the download button.
- **hideParameters**: `string[] | null` – A list of parameters that will not be shown in the set of parameter filters. (More information here)[https://www.metabase.com/docs/latest/questions/sharing/public-links#filter-parameters]
- **font**: `string | null` – The font to use. If not specified, the Metabase instance font or `theme.fontFamily` will be used instead.
- **theme**: `DisplayTheme` – The display theme (e.g., "light", "night", or "transparent" ).
- **initialParameterValues**: `Record<string, string | string[]>` – Query parameters for the dashboard. For a single option, use a `string` value, and use a list of strings for multiple options.
- **withTitle**: `boolean` – Whether the dashboard should display a title.
- **withDownloads**: `boolean | null` – Whether to hide the download button.
- **hiddenParameters**: `string[] | null` – A list of parameters that will not be shown in the set of parameter filters. (More information here)[https://www.metabase.com/docs/latest/questions/sharing/public-links#filter-parameters]
```jsx
......@@ -271,23 +266,19 @@ const config = {...}
export default function App() {
const dashboardId = 1; // This is the dashboard ID you want to embed
const parameterQueryParams = {}; // Define your query parameters here
const initialParameterValues = {}; // Define your query parameters here
const font = "Inter"
// choose parameter names that are in your dashboard
const hideParameters = ["location", "city"]
const hiddenParameters = ["location", "city"]
return (
<MetabaseProvider config={config}>
<StaticDashboard
dashboardId={dashboardId}
parameterQueryParams={parameterQueryParams}
bordered={true}
titled={false}
hideDownloadButton={false}
hideParameters={hideParameters}
font={font}
theme="light"
initialParameterValues={initialParameterValues}
withTitle={false}
withDownloads={false}
hiddenParameters={hideParameters}
/>
</MetabaseProvider>
);
......
......@@ -18,10 +18,10 @@ import type { DashboardId } from "metabase-types/api";
type StaticDashboardProps = {
dashboardId: DashboardId;
initialParameterValues?: Query;
withTitle?: boolean;
withDownloads?: boolean;
hiddenParameters?: string[];
initialParameterValues?: Query;
};
const _StaticDashboard = ({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment