--- 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. Sit amet, consectetur adipiscing elit
{% endcapture %} {% capture notification_colors %} {% for color in site.data.colors.justColors %}
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. Sit amet, consectetur adipiscing elit
{% endfor %} {% endcapture %} {% capture notification_light_colors %} {% for color in site.data.colors.justColors %}
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. Sit amet, consectetur adipiscing elit
{% endfor %} {% endcapture %} {% capture notification_js_html %}
Lorem ipsum
{% endcapture %} {% capture notification_js_code %} document.addEventListener('DOMContentLoaded', () => { (document.querySelectorAll('.notification .delete') || []).forEach(($delete) => { $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.

{% include elements/snippet.html content=notification_colors %} {% include elements/anchor.html name="Light colors" %} {% include elements/new-tag.html version="0.8.1" %} Each color now comes in its light version. Simply append the is-light modifier to obtain the light version of the notification. {% include elements/snippet.html content=notification_light_colors %} {% 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 elements/variables.html type='element' %}