--- title: Notification layout: documentation doc-tab: elements doc-subtab: notification breadcrumb: - home - documentation - elements - elements-notification meta: colors: true sizes: false variables: true --- {% capture notification %}
Lorem ipsum dolor sit amet, consectetur adipiscing elit lorem ipsum dolor. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum felis venenatis efficitur.
{% endcapture %} {% capture notification_js_html %}
Lorem ipsum
{% endcapture %} {% capture notification_js_code %} document.addEventListener('DOMContentLoaded', () => { (document.querySelectorAll('.notification .delete') || []).forEach(($delete) => { const $notification = $delete.parentNode; $delete.addEventListener('click', () => { $notification.parentNode.removeChild($notification); }); }); }); {% endcapture %}

The notification is a simple colored block meant to draw the attention to the user about something. As such, it can be used as a pinned notification in the corner of the viewport. That's why it supports the use of the delete element.

{% include elements/snippet.html content=notification %} {% include elements/anchor.html name="Colors" %}

The notification element is available in all the different colors defined by the $colors Sass map.

{% for color in site.data.colors.justColors %} {% capture foobar %}
Primar lorem ipsum dolor sit amet, consectetur adipiscing elit lorem ipsum dolor. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum felis venenatis efficitur.
{% endcapture %} {% include elements/snippet.html content=foobar %} {% endfor %} {% include elements/anchor.html name="Light colors" %}
Each color also comes in its light version. Simply append the is-light modifier to obtain the light version of the notification.
{% for color in site.data.colors.justColors %} {% capture foobar %}
Primar lorem ipsum dolor sit amet, consectetur adipiscing elit lorem ipsum dolor. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum felis venenatis efficitur.
{% endcapture %} {% include elements/snippet.html content=foobar %} {% endfor %} {% include elements/anchor.html name="JavaScript example" %}

The Bulma package does not come with any JavaScript. Here is however an implementation example, which sets the click handler for Bulma delete all on the page, in vanilla JavaScript.

{% highlight html %}{{ notification_js_html }}{% endhighlight %} {% highlight javascript %}{{ notification_js_code }}{% endhighlight %}
{% include components/variables.html type='element' %}