This is the documentation for , which is no longer actively maintained.View latest version
<tap-toast>
Lightweight toast notification component. Provides different semantic types (info, success, warning, error, loading), custom action button, and imperative static method calls.
Example
Loading...
<tap-button .color=${"positive"} @click=${()=>customElements.get('tap-toast').open('success', 'This is a message')}>
Success
</tap-button>
<tap-button .color=${"notice"} @click=${()=>customElements.get('tap-toast').open('warning', 'This is a message')}>
Warning
</tap-button>
<tap-button .color=${"negative"} @click=${()=>customElements.get('tap-toast').open('error', 'This is a message')}>
Error
</tap-button>
Imperative Calling
import { Toast } from '@mantou/tap-ui/elements/toast';
Toast.open('success', 'This is a message');
Toast.open({
type: 'info',
content: 'Action supported',
action: {
text: 'Undo',
handle: () => console.log('undo'),
},
});
const close = Toast.open({ type: 'loading', content: 'Loading…', duration: Infinity });
close();
API
Shadow DOM; Extends GemElement
Static Properties
| Property |
Type |
instance |
TapToastElement | undefined |
Static Methods
| Method |
Type |
open |
{ (options: ToastOptions): () => void; (type: Type, content: string | TemplateResult): () => void; } |
Instance Properties
| Property(Attribute) |
Reactive |
Type |
items |
Yes |
ToastItem[] |
Other
| Type |
Value |
| Part |
item, icon, body, action |