JSFiddle - React, Tailwind, and code Playground

by Mark Ulybkin

JavaScript

function showNotification(options) {
    var notification = document.createElement("div");
    notification.className = "notification";

    notification.style.top = options.top + "px";
    notification.style.right = options.right + "px";

    if(options.className) {
      notification.classList.add(options.className);
    }

    notification.innerHTML = options.html;
    document.body.appendChild(notification);

    setTimeout(function() {
      document.body.removeChild(notification);
    }, 1500);
  }

  showNotification({
      top: 10,
      right: 10,
      html: "Привет",
      className: "welcome"
  });