Search results


The Template property can be given as the HTML element; this can be either a string or query selector.

The HTML element tag can be given as a string for the Template property.

template: "<div>Toast Content</div>"

The Template property allows getting the template content using the query selector. Here, the element ‘ID’ attribute is specified in the template.

template: "#Template"
<div id="template_toast"> 
    <ejs-toast id="element" extendedTimeout="0" timeOut="120000">
        <e-toast-position X="Right" Y="Bottom"></e-toast-position>
    <ejs-button id="show_toast" content="Show Toast" cssClass="e-btn"></ejs-button>

<br /><br />
<div id='result'></div>
<script id="template_toast_ele" type="text/x-template">
    <div id='template_toast' style="display: none">
        <div class="horizontal-align">
            <div class='toast-content'>
                <div class='toast-title'>
                    Weekend Alarm
                <div class='toast-message'>
                    With traffic, its likely to take 45 minutes to get to jenny's 24th Birthday Bash at Hillside Bar, 454 E.
                    Olive Way by 10:00PM
        <img src="" width="100%" height="70%">

<script type="text/javascript">
        () => {
            var toastObj = document.getElementById('element').ej2_instances[0];
   = document.body;
  { template: document.getElementById('template_toast_ele').innerHTML});
        }, 1000);
    document.getElementById("show_toast").addEventListener('click', function () {
        var toastObj = document.getElementById('element').ej2_instances[0];;
        #loader {
            color: #008cff;
            height: 40px;
            left: 45%;
            position: absolute;
            top: 45%;
            width: 30%;

        #dismiss {
            background-color: #fff;

        body > #element .e-toast {
            width: 400px !important;

        .toast-template-section #reminder {
            text-align: center;
            margin: 15px;

        #toast_custom .e-toast-template {
            display: inline-flex;

        #template_toast .toast-icons {
            font-size: 35px;
            height: auto;
            margin: auto;

            #template_toast .toast-icons.e-alarm::before {
                content: "\e702";

        #template_toast .horizontal-align {
            display: inline-flex;
            flex-direction: row;
            width: 100%;

        #template_toast .horizontal-align,
        #template_toast #snoozedropDown,
        #template_toast .snooze,
        #template_toast .snoozeBtn {
            margin: 10px 0;

            #template_toast .horizontal-align .toast-content .toast-title {
                font-weight: 500;

            #template_toast .horizontal-align .toast-content .toast-message {
                opacity: 0.4;

            #template_toast .horizontal-align .toast-content {
                display: inline-flex;
                flex: 1;
                flex-direction: column;
                margin-left: 10px;
public ActionResult Toast()
    return View();

Output be like the below.

Alt text

See Also