# ToastAction (@salmonui/notifications/toast)

> The ToastAction interface of @salmonui/notifications/toast: A button in the toast.

Canonical: https://salmonui.dev/docs/reference/notifications/toast/ToastAction

```ts
import type { ToastAction } from '@salmonui/notifications/toast';
```

Entry index: https://salmonui.dev/docs/reference/notifications/toast (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/notifications/toast.md).

## Reference

Kind: interface

```ts
interface ToastAction {
    label: ReactNode;
    altText: string;
    onAction?: ((event: MouseEvent<HTMLButtonElement>) => void) | undefined;
}
```

A button in the toast.

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `label` | `label: ReactNode;` |  | The visible button label. |
| `altText` | `altText: 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. |
| `onAction` | `onAction?: ((event: MouseEvent<HTMLButtonElement>) => void) \| undefined;` | optional | Runs on press; the toast then closes with reason `'action'` unless `event.preventDefault()` is called. |
