# Toaster

> Stacks and positions a list of toasts you control.

Render-driven toaster: callers own the toast array and remove items in onDismiss.

- Category: [Actions & feedback](https://tarve.dev/docs.md#actions)
- Import: `import { Toaster } from "@tarve/core";`
- Props type: `ToasterProps`
- Source: [packages/core/src/extra-controls.ts:963](https://github.com/omarcosr/tarve/blob/main/packages/core/src/extra-controls.ts#L963)

## Usage

```tsx title="Toaster.tsx"
import { Button, Column, Toaster, theme, type ToastItem } from "@tarve/core";

let toasts: ToastItem[] = [];

<Column
  align="center"
  style={{ position: "relative", width: 440, height: 240, padding: { top: 24 }, radius: 12, borderWidth: 1, borderColor: theme.colors.border }}
>
  <Button
    onClick={() => {
      toasts = [...toasts.slice(-1), { id: String(Date.now()), title: "Exported", description: "report.pdf is ready." }];
    }}
  >
    Export
  </Button>
  <Toaster
    toasts={toasts}
    position="bottom-right"
    onDismiss={(id) => {
      toasts = toasts.filter((toast) => toast.id !== id);
    }}
  />
</Column>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `toasts` (required) | `ToastItem[]` | — |  |
| `onDismiss` | `(id: string) => void` | — |  |
| `position` | `ToasterPosition` | `"bottom-right"` |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `id`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

## Types

```ts title="ToastItem"
interface ToastItem {
  id: string;
  title: string;
  description?: string;
  variant?: ToastVariant;
  action?: ToastAction;
}
```

```ts title="ToasterPosition"
type ToasterPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
```

Previous: [Toast](https://tarve.dev/docs/components/Toast.md) · Next: [Empty](https://tarve.dev/docs/components/Empty.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/Toaster · Index for agents: https://tarve.dev/llms.txt
