Skip to content

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

671 B
Raw Blame
import {
  type MetabaseAuthConfig,
  MetabaseProvider,
  type SdkDashboardLoadEvent,
} from "@metabase/embedding-sdk-react";
import type { PropsWithChildren } from "react";

const authConfig = {} as MetabaseAuthConfig;

const Example = ({ children }: PropsWithChildren) => {
  // [<snippet example>]
  const handleDashboardLoad: SdkDashboardLoadEvent = (dashboard) => {
    // Send analytics events, show notifications, etc.
  };

  const eventHandlers = {
    onDashboardLoad: handleDashboardLoad,
  };

  return (
    <MetabaseProvider authConfig={authConfig} eventHandlers={eventHandlers}>
      {children}
    </MetabaseProvider>
  );
  // [<endsnippet example>]
};