caroso1222 / notyf

👻 A minimalistic, responsive, vanilla JavaScript library to show toast notifications.
https://carlosroso.com/notyf/
MIT License
2.66k stars 197 forks source link

[Feature Suggestion] Passing HTML element to icon option #100

Closed AbrahemAlhofe closed 3 years ago

AbrahemAlhofe commented 3 years ago

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
});