bstoast5/wiki/USAGE.md
2026-07-08 11:10:37 +01:00

66 lines
1.3 KiB
Markdown

# BSToast5
## Usage
This is the usage guide for **BSToast5**, version **0.1.0.001**.
---
## `Create(options)`
Creates a toast on the page. The default position is the **top-right**.
### Options
```javascript
{
Icon: null,
Title: "",
Time: "",
Message: "",
Animation: true,
AutoHide: true,
Delay: 2000,
Position: "top:0; right:0; margin:20px;"
}
```
### Parameters
| Name | Type | Description |
|------|------|-------------|
| `Icon` | `html` | HTML for the top-left image. |
| `Title` | `string` | Label displayed at the top of the toast. |
| `Time` | `string` | Text displayed at the top-right of the toast, typically the time. |
| `Message` | `string` | Text body of the toast. |
| `Animation` | `bool` | Whether the toast opens with an animation. |
| `AutoHide` | `bool` | Whether the toast automatically closes after a delay. |
| `Delay` | `int` | Delay before automatically closing the toast, in milliseconds. |
| `Position` | `css` | CSS class or CSS positioning used for the toast container. |
### Example
```javascript
BSToast5.Create({
Icon: null,
Title: "Burnt Bread",
Time: "Some time ago",
Message: "Oh noes! I'm toast!",
Animation: true,
AutoHide: true,
Delay: 2500,
Position: "top-0 end-0 p-3"
});
```
---
## `Clear()`
Closes all toasts currently displayed on the page.
### Example
```javascript
BSToast5.Clear();
```