caroso1222 / notyf

👻 A minimalistic, responsive, vanilla JavaScript library to show toast notifications.

Home Page:https://carlosroso.com/notyf/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Suggestion] Passing HTML element to icon option

AbrahemAlhofe opened this issue · comments

Provide a possibility of passing HTML element to icon option as a shorthand of their config to increase a possibility of customization beside the traditional way

const IconOptions = {
 tagName: 'svg',
 className: '.notyf__icon',
 text: ' . . . ',
 color: 'red'
}

const IconElement = document.createElement('svg')
IconElement.classList.add('notyf__icon')
IconElement.innerHTML = ' . . . '
IconElement.style.color = 'red'

const notyf = new Notyf({
 icon: IconElement // or IconOptions
});