Embedded analytics SDK API
    Preparing search index...

    Interface EditableDashboardProps

    interface EditableDashboardProps {
        autoRefreshInterval?: number;
        className?: string;
        dashboardId: string | number;
        dataPickerProps?: Pick<SdkQuestionProps, "entityTypes">;
        drillThroughQuestionHeight?: Height<string | number>;
        drillThroughQuestionProps?: DrillThroughQuestionProps;
        enableEntityNavigation?: boolean;
        hiddenParameters?: string[];
        initialParameters?: ParameterValues;
        onLoad?: (dashboard: MetabaseDashboard | null) => void;
        onLoadWithoutCards?: (dashboard: MetabaseDashboard | null) => void;
        onParametersChange?: (payload: ParameterChangePayload) => void;
        onVisualizationChange?: (
            visualization:
                | "object"
                | "table"
                | "bar"
                | "line"
                | "pie"
                | "scalar"
                | "row"
                | "area"
                | "combo"
                | "pivot"
                | "smartscalar"
                | "gauge"
                | "progress"
                | "funnel"
                | "map"
                | "scatter"
                | "boxplot"
                | "waterfall"
                | "sankey"
                | "list",
        ) => void;
        parameters?: ParameterValues;
        plugins?: MetabasePluginsConfig;
        renderDrillThroughQuestion?: () => ReactNode;
        style?: CSSProperties;
        token?: string | null;
        withCardTitle?: boolean;
        withDownloads?: boolean;
        withSubscriptions?: boolean;
        withTitle?: boolean;
    }
    Index

    Properties

    autoRefreshInterval?: number

    The interval between auto refreshes on the dashboard, in seconds.

    className?: string

    A custom class name to be added to the root element.

    dashboardId: string | number

    The ID of the dashboard.
    This is either:

    • the numerical ID when accessing a dashboard link, i.e. http://localhost:3000/dashboard/1-my-dashboard where the ID is 1
    • the string ID found in the entity_id key of the dashboard object when using the API directly or using the SDK Collection Browser to return data
    dataPickerProps?: Pick<SdkQuestionProps, "entityTypes">

    Additional props to pass to the query builder rendered by InteractiveQuestion when creating a new dashboard question.

    drillThroughQuestionHeight?: Height<string | number>

    Height of a question component when drilled from the dashboard to a question level.

    drillThroughQuestionProps?: DrillThroughQuestionProps

    Props of a question component when drilled from the dashboard to a question level.

    Type Declaration

    Props for the drill-through question

    • Optionalchildren?: ReactNode

      The children of the component

    • OptionalclassName?: string

      A custom class name to be added to the root element.

    • OptionaldataPicker?: EmbeddingDataPicker

      Controls the menu for selecting data sources in questions. You can opt for the full data picker by setting dataPicker = "staged".

    • OptionalentityTypes?: EmbeddingEntityType[]

      An array that specifies which entity types are available in the data picker

    • Optionalheight?: Height<string | number>

      A number or string specifying a CSS size value that specifies the height of the component

    • OptionalinitialCollection?: SdkCollectionId

      The collection to preselect in the save modal's collection picker. Unlike targetCollection, the picker remains visible and the user can choose a different collection. Ignored when targetCollection is set.

    • OptionalinitialSqlParameters?: SqlParameterValues

      Initial values for SQL parameters, slug-keyed. Applied once on mount; user widget edits afterwards are not reflected back to the host.
      For each parameter:

      • set to a value: that value is applied.
      • set to null: strictly cleared, ignoring the parameter's default.
      • omitted (or set to undefined): falls back to the parameter's default (or null if it has no default).
    • OptionalisSaveEnabled?: boolean

      Whether to show the save button.

    • OptionalonBeforeSave?: (
          question: MetabaseQuestion | undefined,
          context: { isNewQuestion: boolean },
      ) => Promise<void>

      A callback function that triggers before saving. Only relevant when isSaveEnabled = true

    • OptionalonRun?: (question: MetabaseQuestion | undefined) => void

      A callback function that triggers when a question is updated, including when a user clicks the Visualize button in the question editor

    • OptionalonSave?: (
          question: MetabaseQuestion,
          context: { dashboardTabId?: number; isNewQuestion: boolean },
      ) => void

      A callback function that triggers when a user saves the question. Only relevant when isSaveEnabled = true

    • Optionalplugins?: MetabasePluginsConfig
    • Optionalstyle?: CSSProperties

      A custom style object to be added to the root element.

    • OptionaltargetCollection?: SdkCollectionId

      The collection to save the question to. This will hide the collection picker from the save modal. Only applicable to interactive questions.

    • Optionaltitle?: SdkQuestionTitleProps

      Determines whether the question title is displayed, and allows a custom title to be displayed instead of the default question title. Shown by default.

    • Optionalwidth?: Width<string | number>

      A number or string specifying a CSS size value that specifies the width of the component

    • OptionalwithAlerts?: boolean

      Enables the ability to set up alerts on the question.

    • OptionalwithChartTypeSelector?: boolean

      Determines whether the chart type selector and corresponding settings button are shown. Only relevant when using the default layout.

    • OptionalwithDownloads?: boolean

      Enables the ability to download results in the question.

    • OptionalwithEditorButton?: boolean

      Determines whether the editor button is shown. Only relevant when using the default layout.

    enableEntityNavigation?: boolean

    When true, internal click behaviors (links to dashboards/questions) are preserved. When false (default for SDK), these click behaviors are filtered out.

    hiddenParameters?: string[]

    A list of parameters to hide.

    initialParameters?: ParameterValues

    Initial values for query parameters, slug-keyed. Applied once on mount; user widget edits afterwards are not reflected back to the host.
    For each parameter:

    • set to a value (string for a single option, array of strings for multiple): that value is applied.
    • set to null: strictly cleared, ignoring the parameter's default.
    • omitted (or set to undefined): falls back to the parameter's default (or null if it has no default).

    • Combining initialParameters and hiddenParameters to filter data on the frontend is a security risk.
    • Combining initialParameters and hiddenParameters to declutter the user interface is fine.
    onLoad?: (dashboard: MetabaseDashboard | null) => void

    Callback that is called when the dashboard is loaded.

    onLoadWithoutCards?: (dashboard: MetabaseDashboard | null) => void

    Callback that is called when the dashboard is loaded without cards.

    onParametersChange?: (payload: ParameterChangePayload) => void

    Fires on parameters change. The payload's source distinguishes the initial state on load ('initial-state'), user edits in the UI ('manual-change'), and auto-updates ('auto-change').

    onVisualizationChange?: (
        visualization:
            | "object"
            | "table"
            | "bar"
            | "line"
            | "pie"
            | "scalar"
            | "row"
            | "area"
            | "combo"
            | "pivot"
            | "smartscalar"
            | "gauge"
            | "progress"
            | "funnel"
            | "map"
            | "scatter"
            | "boxplot"
            | "waterfall"
            | "sankey"
            | "list",
    ) => void

    A callback function that triggers when a question is opened from a dashboard card or when the user changes the visualization type of a question.

    Type Declaration

      • (
            visualization:
                | "object"
                | "table"
                | "bar"
                | "line"
                | "pie"
                | "scalar"
                | "row"
                | "area"
                | "combo"
                | "pivot"
                | "smartscalar"
                | "gauge"
                | "progress"
                | "funnel"
                | "map"
                | "scatter"
                | "boxplot"
                | "waterfall"
                | "sankey"
                | "list",
        ): void
      • Parameters

        • visualization:
              | "object"
              | "table"
              | "bar"
              | "line"
              | "pie"
              | "scalar"
              | "row"
              | "area"
              | "combo"
              | "pivot"
              | "smartscalar"
              | "gauge"
              | "progress"
              | "funnel"
              | "map"
              | "scatter"
              | "boxplot"
              | "waterfall"
              | "sankey"
              | "list"

          the new visualization type

        Returns void

    parameters?: ParameterValues

    Controlled parameter values, slug-keyed. On every render, this object replaces the dashboard's parameter values:

    • a parameter set to a value uses that value.
    • a parameter set to null is cleared, even if it has a default.
    • a parameter omitted from the object (or set to undefined) uses its default (or null if it has no default).

      Pair with onParametersChange to stay in sync with user edits.
    • Combining parameters and hiddenParameters to filter data on the frontend is a security risk.
    • Combining parameters and hiddenParameters to declutter the user interface is fine.

    Additional mapper function to override or add drill-down menu. See the implementing custom actions section for more details.

    renderDrillThroughQuestion?: () => ReactNode

    A custom React component to render the question layout. Use namespaced InteractiveQuestion components to build the layout.

    A custom style object to be added to the root element.

    token?: string | null
    withCardTitle?: boolean

    Whether the dashboard cards should display a title.

    withDownloads?: boolean

    Whether to hide the download button.

    withSubscriptions?: boolean

    Whether to show the subscriptions button.

    withTitle?: boolean

    Whether the dashboard should display a title.