/* * Copyright (c) 2025, Salesforce, Inc. * All rights reserved. * For full license text, see the LICENSE.txt file */ /** * The `lightning/toast` component represents a notification element used to convey a label. * @see {@link https://developer.salesforce.com/docs/component-library/bundle/lightning-toast/documentation |Lightning Toast Documentation} */ declare module "lightning/toast" { import { LightningElement } from "lwc"; /** * Represents a link object with URL and label for toast notifications. */ interface Link { url: string; label: string; } /** * Configuration options for creating a toast notification. */ interface Config { label: string; labelLinks?: Link[] | Record; message?: string; messageLinks?: Link[] | Record; variant?: "info" | "success" | "warning" | "error"; mode?: "dismissible" | "sticky"; [key: `on${string}`]: () => void; } /** * A component that represents a notification element used to convey a label. */ export default class Toast extends LightningElement { /** * An array of { url, label }, which replaces the {0}... {N} placeholders in label string or * a map of { name: { url, label } }, which replaces the {name} ... {anotherName} placeholders in label string */ labelLinks: Link[] | Record; /** * An array of { url, label }, which replaces the {0}... {N} placeholders in message string or * a map of { name: { url, label } }, which replaces the {name} ... {anotherName} placeholders in message string */ messageLinks: Link[] | Record; /** * Title of the toast. */ label: string; /** * Message of the toast. */ message: string; /** * The variant of the toast element. * This value is optional and is used to determine the icon, background color, and text color of the toast element. * Options: 'info', 'warning', 'success', 'error' * @default 'info' */ variant: "info" | "success" | "warning" | "error"; /** * The mode of the toast. * This value is optional and is used to determine whether the toast can be closed by the * user via a close button and whether the toast disappears after a set time period. * Options: 'dismissible', 'sticky' * @default 'sticky' */ mode: "sticky" | "dismissible"; /** * Set focus on the element with content css class selector */ focus(): void; /** * Function to trigger a toast show */ static show(config: Config, source: HTMLElement): void; } }