Milk Admin

Template: toasts

The toast is a small box that appears in the center of the page to send a message of successful saving or some type of error (it could also be about fetch response problems)

<button class="btn btn-primary" onclick="toastsTest1()">Show Toast</button>
<script>
    function toastsTest1() {
        window.toasts.show(`Row saved`, 'success');
    }
</script>


Properties

The Toasts class is instantiated in window.toasts and provides the following methods:

  • show() - shows the message
  • hide() - hides the message
  • body(html, type) - sets the content and color of the box (success,danger,warning,primary)
Loading...