> ## Documentation Index
> Fetch the complete documentation index at: https://webviewer-docs.mupdf.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Toast API

The [`toast`](#toast) object is an instance accessible from the main [MuPDFWebViewer](/api-reference/introduction#initmupdfwebviewer) instance as follows:

```javascript theme={null}
const toast = webViewer.toast;
```

<Note>
  This assumes you have returned your instance name as `webViewer` from the [initMuPDFWebViewer()](/api-reference/introduction#initmupdfwebviewer) promise!
</Note>

## toast

The `toast` object has the following methods:

### show

```typescript theme={null}
show(config: {
  type: 'success' | 'fail' | 'notification';
  content: string;
  header?: string;
  timeout?: number;
}): Promise<undefined>;
```

Shows a toast message.

#### Parameters

<ParamField body="config" type="object" required>
  Configuration object.
</ParamField>

<Expandable title="config properties">
  <ParamField body="config.type" type="'success' | 'fail' | 'notification'" required>
    Toast type (`"success" | "fail" | "notification"`).
  </ParamField>

  <ParamField body="config.content" type="string" required>
    Toast content.
  </ParamField>

  <ParamField body="config.header" type="string">
    Toast header.
  </ParamField>

  <ParamField body="config.timeout" type="number">
    Display duration in milliseconds.
  </ParamField>
</Expandable>

#### Returns

<ResponseField name="result" type="Promise<undefined>" required>
  A Promise.
</ResponseField>

**Example**

```javascript theme={null}
webViewer.toast.show({ type: 'success', content: 'Document opened' });
```
