# Toast
> Announcement toast with an id, alignment, free-floating (x, y) offset, and optional per-part texture overrides.
`gg.lode.lecternapi.api.ui.Toast`
---
## Signature
```java
public record Toast( String id, String title, String message, String icon, String backdrop, String bannerTexture, String bodyTexture, float x, float y, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, int displayTimeMs, int titleColor, int messageColor, float textScale, float scale, int maxLines, int animInMs, int animOutMs, HorizontalAlignment titleAlign, HorizontalAlignment messageAlign )
```
---
## Notes
**Lifecycle by id.** Each toast carries a unique `id`. Sending a
toast with a new id pops it in with the animation. Sending a toast with an
id that's already live *updates* its content in place (no re-popup)
and, if the (x, y) target moves far enough, eases it to the new position
(close-range moves snap immediately). Toasts auto-expire after
`displayTimeMs`; you can also remove them early with
`IUIManager.removeToast(player, id)`.
**Position.** The toast is anchored to the screen using
`horizontalAlignment` / `verticalAlignment`, then offset by
(x, y) pixels.
**Textures.** Defaults to the FancyToasts-style atlas at
`lectern:textures/toast/vanilla.png`. You can override:
- `backdrop` (a full 256×256 atlas in the FancyToasts layout
(used for any region not overridden individually below).
- `bannerTexture`) a standalone 162×14 PNG drawn into the top
banner strip (overrides the atlas banner region).
- `bodyTexture` (a standalone 162×40 PNG drawn into the body
region below the banner (overrides the atlas body region).
- `icon`) already independent of the atlas; either an item id
or a 16×16 texture path.
Set part-overrides to empty string to fall back to the atlas.
---
## Methods
### of
```java
public static Toast of(String id, String title, String message, String icon)
```
Default position: centered horizontally, 60px from the top.
| Parameter | Type |
|---|---|
| `id` | `String` |
| `title` | `String` |
| `message` | `String` |
| `icon` | `String` |
---
### withBackdrop
```java
public static Toast withBackdrop(String id, String title, String message, String icon, String backdrop)
```
Default position + custom backdrop atlas.
| Parameter | Type |
|---|---|
| `id` | `String` |
| `title` | `String` |
| `message` | `String` |
| `icon` | `String` |
| `backdrop` | `String` |
---
### withParts
```java
public static Toast withParts(String id, String title, String message, String icon, String bannerTexture, String bodyTexture)
```
Default position + per-part texture overrides. Pass empty string to skip an override.
| Parameter | Type |
|---|---|
| `id` | `String` |
| `title` | `String` |
| `message` | `String` |
| `icon` | `String` |
| `bannerTexture` | `String` |
| `bodyTexture` | `String` |
---
### at
```java
public static Toast at(String id, String title, String message, String icon, float x, float y, HorizontalAlignment h, VerticalAlignment v)
```
Custom position.
| Parameter | Type |
|---|---|
| `id` | `String` |
| `title` | `String` |
| `message` | `String` |
| `icon` | `String` |
| `x` | `float` |
| `y` | `float` |
| `h` | `HorizontalAlignment` |
| `v` | `VerticalAlignment` |
---
### info
```java
public static Toast info(String id, String title, String message, String icon)
```
White title, default position.
| Parameter | Type |
|---|---|
| `id` | `String` |
| `title` | `String` |
| `message` | `String` |
| `icon` | `String` |
---
### warn
```java
public static Toast warn(String id, String title, String message, String icon)
```
Yellow title, default position.
| Parameter | Type |
|---|---|
| `id` | `String` |
| `title` | `String` |
| `message` | `String` |
| `icon` | `String` |
---
### error
```java
public static Toast error(String id, String title, String message, String icon)
```
Red title, default position.
| Parameter | Type |
|---|---|
| `id` | `String` |
| `title` | `String` |
| `message` | `String` |
| `icon` | `String` |
---
### debug
```java
public static Toast debug(String id, String title, String message, String icon)
```
Aqua title, default position.
| Parameter | Type |
|---|---|
| `id` | `String` |
| `title` | `String` |
| `message` | `String` |
| `icon` | `String` |
---
### withDuration
```java
public Toast withDuration(int displayTimeMs)
```
Copy with a new display duration in ms.
| Parameter | Type |
|---|---|
| `displayTimeMs` | `int` |
---
### withTextScale
```java
public Toast withTextScale(float textScale)
```
Copy with a new title + message text scale.
| Parameter | Type |
|---|---|
| `textScale` | `float` |
---
### withScale
```java
public Toast withScale(float scale)
```
Copy with a new overall toast scale (box, icon, text).
| Parameter | Type |
|---|---|
| `scale` | `float` |
---
### withMaxLines
```java
public Toast withMaxLines(int maxLines)
```
Copy with a new max message-line count.
| Parameter | Type |
|---|---|
| `maxLines` | `int` |
---
### withAnimation
```java
public Toast withAnimation(int animInMs, int animOutMs)
```
Copy with new pop-in / pop-out animation durations in ms.
| Parameter | Type |
|---|---|
| `animInMs` | `int` |
| `animOutMs` | `int` |
---
### withColors
```java
public Toast withColors(int titleColor, int messageColor)
```
Copy with new title + message colors (ARGB).
| Parameter | Type |
|---|---|
| `titleColor` | `int` |
| `messageColor` | `int` |
---
### withTextAlign
```java
public Toast withTextAlign(HorizontalAlignment titleAlign, HorizontalAlignment messageAlign)
```
Copy with new title + message horizontal text alignment.
| Parameter | Type |
|---|---|
| `titleAlign` | `HorizontalAlignment` |
| `messageAlign` | `HorizontalAlignment` |
---
### withPosition
```java
public Toast withPosition(float x, float y, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
```
Copy with a new (x, y) pixel offset and screen anchor.
| Parameter | Type |
|---|---|
| `x` | `float` |
| `y` | `float` |
| `horizontalAlignment` | `HorizontalAlignment` |
| `verticalAlignment` | `VerticalAlignment` |
---
### withIcon
```java
public Toast withIcon(String icon)
```
Copy with a new icon (item id or 16×16 texture path; empty = no icon).
| Parameter | Type |
|---|---|
| `icon` | `String` |
---