---
title: "Customize loading, error, and empty states"
description: "Replace the modular embedding SDK’s default loading screen, error screen, and no-results image with your own."
url: "https://www.metabase.com/docs/latest/embedding/sdk/loading-and-errors"
version: "65"
---

> For the complete documentation index, see [llms.txt](https://www.metabase.com/docs/llms.txt).

# Customize loading, error, and empty states

![A custom error component rendering its own image and message in place of a chart](https://www.metabase.com/docs/latest/embedding/images/custom-error.png)

> Modular embedding SDK is only available on [Pro](https://store.metabase.com/checkout/embedding) and [Enterprise](https://www.metabase.com/product/enterprise) plans (both self-hosted and on Metabase Cloud).

While an embedded component is loading, when it fails, or when a query comes back with no rows, the [modular embedding SDK](https://www.metabase.com/docs/latest/embedding/sdk/introduction.md) renders a screen of its own. You can swap in your own React components and images instead, so all three states match the rest of your app.

These customizations are SDK only. `loaderComponent` and `errorComponent` are props on `MetabaseProvider`, the no-results image comes from a [plugin](https://www.metabase.com/docs/latest/embedding/sdk/plugins.md), and there's no web component equivalent for any of them.

## Replace the loading and error components

Pass `loaderComponent` and `errorComponent` to `MetabaseProvider`. Every embedded component inside that provider picks them up.

```tsx
import {
  MetabaseProvider,
  StaticDashboard,
} from "@metabase/embedding-sdk-react";

<MetabaseProvider
  loaderComponent={() => <div>Analytics is loading...</div>}
  errorComponent={({ type, message, onClose }) => {
    switch (type) {
      case "fixed":
        return (
          <div style={{ position: "fixed", left: 0, right: 0, bottom: 0 }}>
            There was an error: {message}. <span onClick={onClose}>X</span>
          </div>
        );
      case "relative":
      default:
        return <div>There was an error: {message}</div>;
    }
  }}
>
  <StaticDashboard dashboardId={1} />
</MetabaseProvider>
```

`loaderComponent` receives an optional `label` prop with the loading message, which you can render or ignore. `errorComponent` receives the error details, so you can decide how much of the error to show, and where to put it.

## Error component props

These are the props Metabase passes to your `errorComponent`. The `type` prop tells you how Metabase intended to display the error: `relative` errors sit in the flow of the component, while `fixed` errors are meant to overlay the page, like a toast.

| Property                                        | Type                                                                                                                                        |
| :---------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------ |
| <a id="error"></a> `error?`                     | [`Error`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)                                                 |
| <a id="message"></a> `message`                  | [`ReactNode`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0b728411cd1dfb4bd26992bb35a73cf8edaa22e7/types/react/index.d.ts#L478) |
| <a id="onclose"></a> `onClose?`                 | () => `void`                                                                                                                                |
| <a id="type"></a> `type?`                       | `"relative"` \| `"fixed"`                                                                                                                   |
| <a id="withclosebutton"></a> `withCloseButton?` | `boolean`                                                                                                                                   |

## Replace the no-results illustration

By default, Metabase displays a sailboat image when a query returns no results. To use a different image, set the `getNoDataIllustration` and `getNoObjectIllustration` plugins.

Unlike `loaderComponent` and `errorComponent`, these are [plugins](https://www.metabase.com/docs/latest/embedding/sdk/plugins.md), so they go in `pluginsConfig` rather than being props of their own. And instead of a React component, each one returns a base64-encoded image:

```typescript
const img_base64 = "..."; // base64-encoded image

const plugins = {
  getNoDataIllustration: () => img_base64,
  getNoObjectIllustration: () => img_base64,
};

return (
  <MetabaseProvider authConfig={authConfig} pluginsConfig={plugins}>
    <InteractiveDashboard dashboardId={1} />
  </MetabaseProvider>
);
```

`getNoDataIllustration` covers a query that came back with no rows. `getNoObjectIllustration` covers a search that turned up nothing, like a search page or an entity picker with no matches. Both can only be set [globally](https://www.metabase.com/docs/latest/embedding/sdk/plugins.md#plugin-scope), on the provider.

## Further reading

- [Modular embedding SDK plugins](https://www.metabase.com/docs/latest/embedding/sdk/plugins.md)
- [Appearance](https://www.metabase.com/docs/latest/embedding/appearance.md)
- [Configure your embeds](https://www.metabase.com/docs/latest/embedding/config.md)
- [Modular embedding components](https://www.metabase.com/docs/latest/embedding/components.md)
