<dy-toast>
A toast component that displays temporary notifications or messages to users. It supports different types of messages (success, warning, error) and can be triggered programmatically.
Example
Loading...
<dy-button .color=${"positive"} @click=${()=>customElements.get('dy-toast').open('success', 'This is success')}> Success </dy-button> <dy-button .color=${"notice"} @click=${()=>customElements.get('dy-toast').open('warning', 'This is warning')}> Warning </dy-button> <dy-button .color=${"negative"} @click=${()=>customElements.get('dy-toast').open('error', 'This is error')}> Error </dy-button>
import { Toast } from 'duoyun-ui/elements/toast';
function onClick() {
Toast.open('success', 'This is success');
}API
DuoyunToastElement
Extends TapToastElement
TapToastElement
Shadow DOM; Extends GemElement
TapToastElement Static Properties
| Property | Type |
|---|---|
instance |
TapToastElement | undefined |
TapToastElement Static Methods
| Method | Type |
|---|---|
open |
{ (options: ToastOptions): () => void; (type: Type, content: string | TemplateResult): () => void; } |
TapToastElement Instance Properties
| Property(Attribute) | Reactive | Type |
|---|---|---|
items |
Yes | ToastItem[] |
TapToastElement Other
| Type | Value |
|---|---|
| Part | item, icon, body, action |
