Interface for a class Toast
EmitType<ToastBeforeCloseArgs>
Triggers the event before the toast close.
Triggers the event before the toast shown.
EmitType<BeforeSanitizeHtmlArgs>
Event triggers before sanitize the value.
The event will be fired while clicking on the Toast.
Trigger the event after the Toast hides.
EmitType<Event>
Triggers the event after the Toast gets created.
EmitType<Event>
Triggers the event after the Toast gets destroyed.
Triggers the event after the Toast shown on the target container.
Specifies the animation configuration settings for showing and hiding the Toast.
Specifies the collection of Toast action buttons
to be rendered with the given
Button model properties and its click action handler.
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { ToastComponent } from '@syncfusion/ej2-react-notifications';
import { SampleBase } from '../common/sample-base';
export class Animation extends SampleBase<{}, {}> {
constructor(props: {}) {
this.buttons = [{ model: { content:`Click`}
}]
}
public create(): void {
this.toastObj.show({ content: 'toast'});
}
public render(): JSX.Element {
return (<ToastComponent ref={(toast) => { this.toastObj = toast; }} buttons={this.buttons} created={this.create.bind(this)} ></ToastComponent>
);
}
}
string
| HTMLElement
| Function
Specifies the content to be displayed on the Toast. Accepts selectors, string values and HTML elements.
string
Defines single/multiple classes (separated by space) to be used for customization of Toast.
boolean
Defines whether to allow the cross-scripting site or not.
boolean
Enable or disable persisting component’s state between page reloads.
boolean
Enable or disable rendering component in right to left direction.
number
Specifies the Toast display time duration after interacting with the Toast.
string
| number
Specifies the height of the Toast in pixels/number/percentage. Number value is considered as pixels.
string
Defines CSS classes to specify an icon for the Toast which is to be displayed at top left corner of the Toast.
string
Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.
boolean
Specifies the newly created Toast message display order while multiple toast’s are added to page one after another. By default, newly added Toast will be added after old Toast’s.
Specifies the position of the Toast message to be displayed within target container. In the case of multiple Toast display, new Toast position will not update on dynamic change of property values until the old Toast messages removed. X values are: Left , Right ,Center Y values are: Top , Bottom
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { ToastComponent } from '@syncfusion/ej2-react-notifications';
import { SampleBase } from '../common/sample-base';
export class Animation extends SampleBase<{}, {}> {
constructor(props: {}) {
this.position = { X: 'Right', Y: 'Top' }
}
public create(): void {
this.toastObj.show({ content: 'toast'});
}
public render(): JSX.Element {
return (<ToastComponent ref={(toast) => { this.toastObj = toast; }} position={this.position} created={this.create.bind(this)} ></ToastComponent>
);
}
}
Specifies whether to show the progress bar with left to right direction to denote the Toast message display timeout.
boolean
Specifies whether to show the close button in Toast message to close the Toast.
boolean
Specifies whether to show the progress bar to denote the Toast message display timeout.
HTMLElement
| Element
| string
Specifies the target container where the Toast to be displayed.
Based on the target, the positions such as Left
, Top
will be applied to the Toast.
The default value is null, which refers the document.body
element.
string
| Function
Specifies the HTML element/element ID as a string that can be displayed as a Toast. The given template is taken as preference to render the Toast, even if the built-in properties such as title and content are defined.
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { ToastComponent } from '@syncfusion/ej2-react-notifications';
import { SampleBase } from '../common/sample-base';
export class Animation extends SampleBase<{}, {}> {
public create(): void {
this.toastObj.show();
}
public render(): JSX.Element {
function templatedata(): JSX.Element {
return <div>toast</div>
}
return (<ToastComponent ref={(toast) => { this.toastObj = toast; }} template={templatedata.bind(this)} created={this.create.bind(this)} ></ToastComponent>
);
}
}
number
Specifies the Toast display time duration on the page in milliseconds.
string
| Function
Specifies the title to be displayed on the Toast. Accepts selectors, string values and HTML elements.
string
| number
Specifies the width of the Toast in pixels/numbers/percentage. Number value is considered as pixels.
In mobile devices, default width is considered as 100%
.