<tap-toast>

Lightweight toast notification component. Provides different semantic types (info, success, warning, error, loading), custom action button, and imperative static method calls.

Example

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'),
  },
});

// Returns a close function; `duration: Infinity` keeps it until closed
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