Toast
Toast Props
| Name | Type | Default | Description |
|---|---|---|---|
type | ToastType | 'info' | Visual type. Optional: info, success, warning, error. |
body | string | - | Toast message text. |
autoClose | boolean | true | Whether the toast auto-dismisses. |
duration | number | 5000 | Auto-dismiss duration in milliseconds. |
Toast Events
| Name | Description |
|---|---|
close | Emitted when the toast is dismissed. |
Toast Slots
| Name | Description |
|---|---|
default | Custom toast content. Defaults to body. |
ToastViewport Props
| Name | Type | Default | Description |
|---|---|---|---|
placement | ToastPlacement | 'bottom-center' | Position of the toast stack in the viewport. Optional: top-start, top-center, top-end, bottom-start, bottom-center, bottom-end. |
useToast
ts
const toast = useToast()
const dismiss = toast({ body: 'Hello', type: 'info', duration: 3000 })
// dismiss manually
dismiss()
// dismiss all
toast.clear()