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

# Toast – Code

> Toasts are temporary alerts that appear as a direct result of a user action.

export const LiveCode = ({children, customHeight, clickToLoad, example, fullWidth, fullHeight, hideCodeInLiveCode, screenshot, screenshotOnly, showCode: showCodeProp}) => {
  const SCREENSHOTS_BASE = "https://servicetitan.github.io/anvil2-docs-live-code/screenshots";
  const STACKBLITZ_BASE = "https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples";
  const [showCodeBlock, setShowCodeBlock] = useState(showCodeProp ?? false);
  const [isLocalOverride, setIsLocalOverride] = useState(false);
  useEffect(() => {
    const examplePath = `/images/live-code-screenshots-tmp/${example}.png`;
    fetch(examplePath, {
      method: "HEAD"
    }).then(r => {
      if (r.ok) setIsLocalOverride(true);
    }).catch(() => {});
  }, [example]);
  const screenshotBase = isLocalOverride ? "/images/live-code-screenshots-tmp" : SCREENSHOTS_BASE;
  if (screenshotOnly) {
    return <Frame className="flex flex-col">
        <div className="flex dark:hidden" style={{
      justifyContent: "center",
      alignItems: "center",
      width: fullWidth ? "100%" : "50%",
      minHeight: fullHeight ? "284px" : undefined,
      background: "#FFFFFF"
    }}>
          <img srcset={`${screenshotBase}/${example}.png, ${screenshotBase}/${example}-2x.png 2x`} src={`${screenshotBase}/${example}.png`} alt={example} noZoom />
        </div>
        <div className="hidden dark:flex" style={{
      justifyContent: "center",
      alignItems: "center",
      width: fullWidth ? "100%" : "50%",
      minHeight: fullHeight ? "284px" : undefined,
      background: "#141414"
    }}>
          <img srcset={`${screenshotBase}/${example}-dark.png, ${screenshotBase}/${example}-dark-2x.png 2x`} src={`${screenshotBase}/${example}-dark.png`} alt={example} noZoom />
        </div>
      </Frame>;
  }
  if (screenshot) {
    return <Frame className="flex flex-col -mb-2">
        <div className="flex dark:hidden bg-white dark:bg-codeblock border border-gray-950/10 dark:border-white/10 dark:twoslash-dark rounded-2xl overflow-hidden" style={{
      justifyContent: "center",
      alignItems: "center",
      width: fullWidth ? "100%" : "50%",
      minHeight: fullHeight ? "284px" : undefined
    }}>
          <img srcset={`${screenshotBase}/${example}.png, ${screenshotBase}/${example}-2x.png 2x`} src={`${screenshotBase}/${example}.png`} alt={example} noZoom />
        </div>

        <div className="hidden dark:flex bg-white dark:bg-codeblock border border-gray-950/10 dark:border-white/10 dark:twoslash-dark rounded-2xl overflow-hidden" style={{
      background: "#141414",
      justifyContent: "center",
      alignItems: "center",
      width: fullWidth ? "100%" : "50%",
      minHeight: fullHeight ? "284px" : undefined
    }}>
          <img srcset={`${screenshotBase}/${example}-dark.png, ${screenshotBase}/${example}-dark-2x.png 2x`} src={`${screenshotBase}/${example}-dark.png`} alt={example} noZoom />
        </div>

        <div className="flex justify-end items-center text-xs py-2 px-1 gap-4">
          {!showCodeProp ? <button className="inline-flex justify-end items-center text-gray-700 dark:text-gray-50 hover:text-blue-500 dark:hover:text-blue-300 transition-colors group self-end gap-1 cursor-pointer" onClick={() => setShowCodeBlock(!showCodeBlock)} style={{
      appearance: "none"
    }}>
              <Icon icon="code" size="12px" className="group-hover:bg-blue-500 dark:group-hover:bg-blue-300" />
              <span>{showCodeBlock ? "Hide code" : "Show code"}</span>
            </button> : null}

          <a className="inline-flex justify-end items-center hover:text-blue-500 dark:hover:text-blue-300 transition-colors group self-end gap-1" href={`${STACKBLITZ_BASE}/${example}?file=src/App.tsx`} target="_blank" rel="noreferrer">
            <Icon icon="bolt" size="12px" className="group-hover:bg-blue-500 dark:group-hover:bg-blue-300" />
            <span>StackBlitz demo</span>
          </a>
        </div>

        <div className="grid transition-[grid-template-rows] duration-300 ease-in-out overflow-auto overflow-y-hidden overflow-x-auto" style={showCodeBlock ? {
      gridTemplateRows: "1fr"
    } : {
      gridTemplateRows: "0fr"
    }}>
          <div style={{
      minHeight: 0,
      overflowX: "auto",
      overflowY: "hidden",
      marginBlockStart: "-1.25rem",
      marginBlockEnd: "-1.5rem"
    }}>
            {children}
          </div>
        </div>
      </Frame>;
  } else {
    return <div style={{
      display: "flex",
      width: fullWidth ? "100%" : "50%",
      minHeight: customHeight ? customHeight : "316px",
      resize: "vertical",
      overflow: "auto"
    }}>
        <iframe title={example} style={{
      flex: 1,
      width: fullWidth ? "100%" : "50%",
      minHeight: customHeight ? customHeight : "316px"
    }} src={`${STACKBLITZ_BASE}/${example}?embed=1&hideNavigation=1&hideExplorer=1&terminalHeight=0&file=src/App.tsx${clickToLoad ? "&ctl=1" : ""}${hideCodeInLiveCode ? "&view=preview" : ""}`} allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" />
      </div>;
  }
};

<Tabs>
  <Tab title="Implementation">
    <LiveCode showCode example="toast-playground" fullWidth>
      ```tsx lines expandable theme={null}
      import { toast, Flex, Button } from "@servicetitan/anvil2";

      function App() {
        const config = {
          title: "Title",
          message: "Lorem ipsum dolor sit amet.",
          actions: {
            primary: {
              label: "Primary",
              appearance: "primary" as const,
            },
            secondary: {
              label: "Secondary",
            },
          },
        };

        return (
          <div style={{ minHeight: "284px" }}>
            <Flex gap="2">
              <Button onClick={() => toast.info(config)} appearance="primary">
                Show toast
              </Button>
              <Button onClick={() => toast.dismiss()}>Dismiss</Button>
            </Flex>
          </div>
        );
      }

      export default App;
      ```
    </LiveCode>

    ## Common Examples

    ### Toast methods

    There are seven `toast` methods available in Anvil2. Four of them are used to create standard toasts with varying styles:

    * `toast.info()`
    * `toast.success()`
    * `toast.warning()`
    * `toast.danger()`

    The fifth, `toast.promise()`, generates a pending toast, and uses a completed promise to update the toast based on a response.

    The other two are used to manage existing toast messages:

    * `toast.update()`
    * `toast.dismiss()`

    ```tsx theme={null}
    import { Button, toast } from "@servicetitan/anvil2";

    function ExampleComponent() {
      return (
        <Button
          onClick={() =>
            toast.info({
              title: "Toast title",
              message: "Lorem ipsum dolor sit amet",
            })
          }
        >
          Click me!
        </Button>
      );
    }
    ```

    ### Toasters

    To use the `toast` methods, there must be a `Toaster` component rendered somewhere up the tree, usually at the root of the application. The toaster is the container that toast messages appear in, and manages positioning, stacking, and dismiss timing updates.

    ```tsx theme={null}
    import { AnvilProvider, Toaster } from "@servicetitan/anvil2";

    function App({ children }) {
      return (
        <>
          <Toaster id="app-toaster" />
          <AnvilProvider>
            {children}
          </AnvilProvider>
        </>
      )
    }
    ```

    #### Multiple toasters

    In order to avoid double-rendering toast messages, the `Toaster` component will only render toast messages if it doesn't detect another `Toaster`. This means if you are using a `Toaster` in a standalone MFE, it will display toasts, but will defer to the host's `Toaster` when it is loaded in the host application.

    **Note:** A limitation exists where the `Toaster` cannot detect a `Toaster` in a sibling MFE. For this reason, there must be a `Toaster` in the host app to which MFEs will defer.

    #### Toaster config

    To ensure consistency, the `Toaster` component should handle most of the config options for toast messages within an app. The following props can be added:

    ```tsx theme={null}
    type ToasterProps = {
      // defaults
      id: string;
      focusKey?: string; // "t"
      toastsBeforeStack?: number; // 3
    };
    ```

    ### Showing basic toasts

    #### Basic toast method examples

    <LiveCode showCode example="toast-method" fullWidth>
      ```tsx lines expandable theme={null}
      import { toast, Flex, Grid, Button } from "@servicetitan/anvil2";

      function App() {
        const config = {
          title: "Toast title",
          message: "Lorem ipsum dolor sit amet.",
          duration: 8000,
        };

        return (
          <div style={{ minHeight: "284px" }}>
            <Flex justifyContent="center">
              <Grid templateColumns="repeat(2, 12rem)" gap="2">
                <Button onClick={() => toast.info(config)} style={{ width: "100%" }}>
                  Show info toast
                </Button>
                <Button
                  onClick={() => toast.success(config)}
                  style={{ width: "100%" }}
                >
                  Show success toast
                </Button>
                <Button
                  onClick={() => toast.warning(config)}
                  style={{ width: "100%" }}
                >
                  Show warning toast
                </Button>
                <Button
                  onClick={() => toast.danger(config)}
                  style={{ width: "100%" }}
                >
                  Show danger toast
                </Button>
              </Grid>
            </Flex>
          </div>
        );
      }

      export default App;
      ```
    </LiveCode>

    #### Toast method config object

    All of the basic toast methods accept a config object with the following shape:

    ```tsx theme={null}
    type toastProps = {
      title: string;
      actions?: { primary: ToastAction; secondary?: ToastAction };
      aiMark?: boolean | AiMarkWithTooltipOrPopoverConfig;
      containerClassName?: string;
      duration?: number | false;
      message?: string;
      onClose?: MouseEventHandler<HTMLButtonElement>;
      onDismiss?: () => void;
      progress?: number | "indeterminate";
      toastClassName?: string;
    }
    ```

    #### Notes for basic toast methods

    * Toasts with `actions` will ignore the duration setting to allow users a chance to perform an action.
    * The toast config passed to a toast method will override some of the defaults set on the `Toaster` component.

    ### Using promise toasts

    #### Promise toast example

    <LiveCode showCode example="toast-promise" fullWidth>
      ```tsx lines expandable theme={null}
      import { toast, Flex, Button } from "@servicetitan/anvil2";

      function App() {
        const config = {
          loading: {
            title: "Loading...",
            message: "This is loading!",
          },
          success: (data: string) => ({
            title: "Success!",
            message: data,
          }),
          error: (error: string) => ({
            title: "Error!",
            message: `${error}`,
          }),
        };

        const promiseResolved: () => Promise<string> = async () => {
          return new Promise((resolve) => {
            setTimeout(() => resolve("Promised message!"), 2000);
          });
        };

        const promiseRejected: () => Promise<string> = async () => {
          return new Promise((_, reject) => {
            setTimeout(() => reject("The promise was rejected."), 2000);
          });
        };

        return (
          <div style={{ minHeight: "284px" }}>
            <Flex gap="2">
              <Button
                onClick={() => {
                  toast.promise(promiseResolved(), config);
                }}
              >
                Resolve
              </Button>
              <Button
                onClick={() => {
                  toast.promise(promiseRejected(), config);
                }}
              >
                Reject
              </Button>
            </Flex>
          </div>
        );
      }

      export default App;
      ```
    </LiveCode>

    #### Promise toast method config object

    The config object passed to toast.promise() should have three properties – `loading`, `success`, and `error`.

    ```tsx theme={null}
    type PromiseToastMethodConfig = {
      loading: toastProps; // same as basic config object
      success: (message: string) => toastProps;
      error: (message: string) => toastProps;
    };
    ```

    #### Notes for promise toasts

    * The first parameter of the `toast.promise()` method should be a `Promise` that either resolves or rejects. Otherwise, the loading state will render indefinitely.

    ### Using progress toasts

    <LiveCode showCode example="toast-progress" fullWidth>
      ```tsx lines expandable theme={null}
      import { toast, Flex, Button } from "@servicetitan/anvil2";
      import { useEffect, useRef, useState } from "react";

      function App() {
        const [toastId, setToastId] = useState<string | null>(null);
        const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);

        useEffect(() => {
          return () => {
            if (intervalRef.current) {
              clearInterval(intervalRef.current);
              intervalRef.current = null;
            }
          };
        }, []);

        const startProgress = () => {
          let progress = 0;

          const id = toast.info({
            title: "Uploading file...",
            message: "Your file is being uploaded.",
            duration: false,
            progress,
            onDismiss: () => {
              if (intervalRef.current) {
                clearInterval(intervalRef.current);
                intervalRef.current = null;
              }
              setToastId(null);
            },
          });

          setToastId(id);

          intervalRef.current = setInterval(() => {
            progress += 10;
            toast.update(id, { progress });

            if (progress >= 100) {
              clearInterval(intervalRef.current!);
              intervalRef.current = null;
              toast.update(id, {
                title: "Upload complete",
                message: "Your file has been uploaded successfully.",
                status: "success",
                progress: 100,
                duration: 5000,
              });
              setToastId(null);
            }
          }, 400);
        };

        return (
          <div style={{ minHeight: "284px" }}>
            <Flex gap="2">
              <Button
                onClick={startProgress}
                appearance="primary"
                disabled={toastId !== null}
              >
                Upload file
              </Button>
            </Flex>
          </div>
        );
      }

      export default App;
      ```
    </LiveCode>

    The `progress` property can be passed to any toast creation method or `toast.update()` to display a [Progress Bar](/docs/web/components/progress-bar/design) inside the toast.

    #### Notes for progress toasts

    * Set `progress` to a number from 0–100 for a determinate progress bar, or `"indeterminate"` for an indeterminate one.
    * Use `toast.update()` to advance the progress value as work completes.
    * Set `duration: false` to prevent the toast from auto-dismissing before the operation finishes.
    * When the operation completes, use `toast.update()` with a new `status` to change the toast's visual style.

    ### Updating toasts

    <LiveCode showCode example="toast-update" fullWidth>
      ```tsx lines expandable theme={null}
      import { toast, Flex, Button } from "@servicetitan/anvil2";
      import { useState } from "react";

      function App() {
        const [toastId, setToastId] = useState<string | null>(null);

        const config = {
          title: "Title",
          message: "Lorem ipsum dolor sit amet.",
          onClose: () => setToastId(null),
        };

        const updatedConfig = {
          title: "New title",
          message: "Woah, it changed!",
        };

        return (
          <div style={{ minHeight: "284px" }}>
            <Flex gap="2">
              <Button
                onClick={() => setToastId(toast.info(config))}
                disabled={toastId !== null}
                appearance="primary"
              >
                Show toast
              </Button>
              <Button onClick={() => toastId && toast.update(toastId, updatedConfig)}>
                Update toast
              </Button>
            </Flex>
          </div>
        );
      }

      export default App;
      ```
    </LiveCode>

    #### Notes for updating toasts

    * An `id` for the toast message to be updated is required as the first parameter of the `toast.update()` method. This `id` is provided as the return value of any of the toast creation methods.
    * Any of the `toastProps` can be updated using this method, including `progress`.
    * `status` can also be set in `toast.update()` to change the toast's visual style (e.g. changing from `"info"` to `"success"` when an operation completes).

    ### Dismissing toasts

    <LiveCode showCode example="toast-dismiss" fullWidth>
      ```tsx lines expandable theme={null}
      import { toast, Flex, Button } from "@servicetitan/anvil2";
      import { useState } from "react";

      function App() {
        const [latestToastId, setLatestToastId] = useState<string | null>(null);

        const config = {
          title: "Title",
          message: "Lorem ipsum dolor sit amet.",
        };

        return (
          <div style={{ minHeight: "284px" }}>
            <Flex gap="2">
              <Button
                onClick={() => setLatestToastId(toast.info(config))}
                appearance="primary"
              >
                Show toast
              </Button>
              <Button onClick={() => latestToastId && toast.dismiss(latestToastId)}>
                Dismiss latest toast
              </Button>
              <Button onClick={() => toast.dismiss()}>Dismiss all toasts</Button>
            </Flex>
          </div>
        );
      }

      export default App;
      ```
    </LiveCode>

    #### When toasts are dismissed

    <Info>
      **Toasts without `actions`** auto-dismiss after the `duration` expires.

      **Toasts with `actions`** ignore the `duration` setting and are only dismissed when the user takes direct action: pressing the "x" button, clicking a toast action button, or calling `toast.dismiss()` programmatically.
    </Info>

    Toasts can be dismissed in four ways:

    1. By pressing the "x" button on the toast message.
    2. By swiping the toast message off the screen on touch screens.
    3. Automatically after the `duration` expires, if supplied on the `Toaster` or in the `toast` method.
    4. Programmatically using the `toast.dismiss()` method.

    #### Notes for dismissing toasts

    * The `toast.dismiss()` method accepts an optional `id` parameter to dismiss a specific toast message. This `id` is given as the return value of any of the toast creation methods.
    * If no `id` is provided, all visible toast messages will be dismissed.
    * If a `duration` is provided, and the toast becomes stacked (hidden), the timeout is paused and restarted once the toast becomes visible again.

    #### Callbacks for toast dismissal

    There are two callback parameters available on the toast methods:

    * `onClose` is passed to the "x" button's `onClick`, so it is only run when the user activates the button
    * `onDismiss` is run anytime the toast is removed, including on "x" button click, when `toast.dismiss()` is run, or when the `duration` expires on the toast

    ### Using toast actions

    <LiveCode showCode example="toast-actions" fullWidth>
      ```tsx lines expandable theme={null}
      import { toast, Button } from "@servicetitan/anvil2";

      function App() {
        const config = {
          title: "Title",
          message: "Lorem ipsum dolor sit amet.",
          actions: {
            primary: {
              label: "Primary",
              appearance: "primary" as const,
            },
            secondary: {
              label: "Secondary",
            },
          },
        };

        return (
          <div style={{ minHeight: "284px" }}>
            <Button onClick={() => toast.info(config)}>Show toast</Button>
          </div>
        );
      }

      export default App;
      ```
    </LiveCode>

    The `actions` property of the `toastConfig` that is passed to `toast` creation methods can be used to add one or two [Button](/docs/web/components/button/design) components to the toast message. The `actions` property accepts an object with two properties:

    ```tsx theme={null}
    type ActionsParameter = { primary: ToastAction; secondary?: ToastAction };
    ```

    The `ToastAction` type is used to update some [Button](/docs/web/components/button/design) props of the action button.

    ```tsx theme={null}
    type ToastAction = Pick<ButtonProps, "appearance" | "onClick"> & {
      label: string;
    };
    ```

    ### AI Mark

    Add an [AI Mark](/docs/web/components/ai-mark/code) inline after the toast title by including `aiMark` in the toast config. Use `true` for the sparkle only, or pass tooltip or popover configuration.

    <LiveCode showCode example="ai-mark-toast" fullWidth>
      ```tsx lines expandable theme={null}
      import { toast, Flex, Grid, Button } from "@servicetitan/anvil2";

      function App() {
        const config = {
          title: "AI dispatch digest",
          message:
            "Today: 6 jobs—2 AC tune-ups, 2 drain calls, 1 heat-pump startup, and 1 panel inspection. Two are marked urgent.",
          duration: 8000,
          aiMark: true,
        };

        return (
          <div style={{ minHeight: "284px" }}>
            <Flex justifyContent="center">
              <Grid templateColumns="repeat(2, 12rem)" gap="2">
                <Button onClick={() => toast.info(config)} style={{ width: "100%" }}>
                  Show info toast
                </Button>
                <Button
                  onClick={() => toast.success(config)}
                  style={{ width: "100%" }}
                >
                  Show success toast
                </Button>
                <Button
                  onClick={() => toast.warning(config)}
                  style={{ width: "100%" }}
                >
                  Show warning toast
                </Button>
                <Button
                  onClick={() => toast.danger(config)}
                  style={{ width: "100%" }}
                >
                  Show danger toast
                </Button>
              </Grid>
            </Flex>
          </div>
        );
      }

      export default App;
      ```
    </LiveCode>

    ### Toast event handling

    Whenever a toast is added, updated, or dismissed, the `Toaster` component runs the `onToastEvent` callback with the following object passed in the event:

    ```tsx theme={null}
    type ToastEventType = {
      eventType: "add" | "update" | "dismiss" | "dismiss-all";
      toastCount: number;
      id?: string;
      toasterId?: string;
      toastProps?: ToastProps | ToastUpdateProps;
    };
    ```

    Some of the parameters will only show when certain toast methods are called. For example, `toast.dismiss()` will not include `toastProps`, since it affects all of the existing toasts.

    #### MFE Toaster note for toast event handling

    The `Toaster` used in the monolith/host app will take precedence over any loaded by an MFE, so the `onToastEvent` will generally not work for MFEs that are run in a host app that includes its own `Toaster`, such as monolith.

    ## React Accessibility

    * When `actions` are used, do not add a `duration` so that users have time to decide if they would like to take action.
    * By default, pressing the "t" key on the keyboard while a toast message is visible will shift focus to the toast. This is announced by screen readers to make the messages easily accessible for some users. If the "t" key is used for another hot key, this can be overridden using the `focusKey` prop of the `Toaster`.

    For further guidance on creating accessible status updates, see [accessible status messages and notifications best practices](/docs/accessibility/changing-content#status-updates).
  </Tab>

  <Tab title="Toaster Props">
    ```tsx theme={null}
    <Toaster
      id="app-toaster"
      focusKey="t"
      toastsBeforeStack={3}
      onToastEvent={(event) => console.log(event)}
    />
    ```

    ## `Toaster` Props

    MFE Warning: When a `Toaster` is used in an MFE that is loaded into monolith, or any other host app that includes its own `Toaster`, the host app `Toaster` will take precedence. Any props used on an MFE `Toaster` will only work when it is used outside of the host app. This allows for a centralized config and rendering in the host application.

    <ParamField path="id" type="string" required />

    <ParamField path="focusKey" type="string" default="t">
      Hot key for focusing on first toast message.
    </ParamField>

    <ParamField path="onToastEvent" type="(toastEvent: ToastEventType) => void">
      See [Toast event
      handling](/docs/web/components/toast/code#toast-event-handling)
    </ParamField>

    <ParamField path="toastsBeforeStack" type="number" default="3">
      Determines how many toasts to show before they stack in the UI.
    </ParamField>
  </Tab>

  <Tab title="Toast Methods">
    ```tsx theme={null}
    // Basic toast methods
    toast.info({ title: "Info", message: "Message" });
    toast.success({ title: "Success", message: "Message" });
    toast.warning({ title: "Warning", message: "Message" });
    toast.danger({ title: "Danger", message: "Message" });

    // Promise toast
    toast.promise(promise, {
      loading: { title: "Loading..." },
      success: (message) => ({ title: "Success", message }),
      error: (message) => ({ title: "Error", message }),
    });

    // Update toast
    toast.update(id, { title: "Updated", message: "New message" });

    // Dismiss toast
    toast.dismiss(id);
    ```

    ## Toast Methods

    ### Basic toast creation methods API

    This API applies to the following methods:

    * `toast.info()`
    * `toast.success()`
    * `toast.warning()`
    * `toast.danger()`

    <ParamField path="config" type="toastProps">
      See [Toast method config
      object](/docs/web/components/toast/code#toast-method-config-object).
    </ParamField>

    This API applies to the `toast.promise()` method:

    <ParamField path="promise" type="Promise">
      See [Notes for promise
      toasts](/docs/web/components/toast/code#notes-for-promise-toasts).
    </ParamField>

    <ParamField path="config" type="{ loading: toastProps, success: (message: string) => toastProps, error: (message: string) => toastProps}">
      See [Promise toast method config
      object](/docs/web/components/toast/code#promise-toast-method-config-object).
    </ParamField>

    ### Updating toasts API

    This API applies to the `toast.update()` method:

    <ParamField path="id" type="string">
      See [Updating toasts](/docs/web/components/toast/code#updating-toasts).
    </ParamField>

    <ParamField path="updatedConfig" type={`Partial<toastProps> & { status?: "info" | "success" | "warning" | "danger" }`}>
      Only add properties that should change. Use `status` to change the toast's visual style on update.
    </ParamField>

    ### Dismissing toasts API

    This API applies to the `toast.dismiss()` method:

    <ParamField path="id" type="string">
      If omitted, all toasts are dismissed. See [Updating
      toasts](/docs/web/components/toast/code#dismissing-toasts).
    </ParamField>
  </Tab>
</Tabs>
