View as Markdown

API reference: @salmonui/notifications/toast

ToastActioninterface

import type { ToastAction } from '@salmonui/notifications/toast';
interface ToastAction {
    label: ReactNode;
    altText: string;
    onAction?: ((event: MouseEvent<HTMLButtonElement>) => void) | undefined;
}

A button in the toast.

ToastAction members (3)
NameSignatureDescription
labellabel: ReactNode;

The visible button label.

altTextaltText: string;

Keyboard hint announced with the toast, for example "Undo with F6 then Enter". Required: the toast may be gone before a pointer reaches it.

onActionoptionalonAction?: ((event: MouseEvent<HTMLButtonElement>) => void) | undefined;

Runs on press; the toast then closes with reason 'action' unless event.preventDefault() is called.