# toastAction

> Runs a toast action's callback on click; unless the button submits a form, whose navigation carries on, toast `id` then leaves `toaster`.

```ts
import { toastAction } from "@sdxc/ui/app";
```

Runs a toast action's callback on click; unless the button submits a form,
whose navigation carries on, toast `id` then leaves `toaster`.

## Signature

```ts
toastAction(toaster: Toaster<unknown>, id: string, onAction: (() => void) | undefined): MixinDescriptor<HTMLButtonElement>
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `toaster` | `Toaster<unknown>` |  |
| `id` | `string` |  |
| `onAction` | `(() => void) \| undefined` |  |

## Examples

```tsx
<button mix={[toastAction(toaster, id, restore)]}>Undo</button>
```
