2016-09-11 11:00:49 +00:00
|
|
|
---
|
2017-07-29 12:02:00 +00:00
|
|
|
title: Notification
|
2024-03-21 16:11:54 +00:00
|
|
|
layout: docs
|
|
|
|
theme: library
|
2016-09-11 11:00:49 +00:00
|
|
|
doc-tab: elements
|
|
|
|
doc-subtab: notification
|
2018-04-09 13:15:31 +00:00
|
|
|
breadcrumb:
|
2024-03-21 16:11:54 +00:00
|
|
|
- home
|
|
|
|
- documentation
|
|
|
|
- elements
|
|
|
|
- elements-notification
|
2018-04-09 13:15:31 +00:00
|
|
|
meta:
|
|
|
|
colors: true
|
|
|
|
sizes: false
|
|
|
|
variables: true
|
2016-09-11 11:00:49 +00:00
|
|
|
---
|
2017-07-29 12:02:00 +00:00
|
|
|
{% capture notification %}
|
2016-09-11 11:00:49 +00:00
|
|
|
<div class="notification">
|
|
|
|
<button class="delete"></button>
|
2024-03-21 16:11:54 +00:00
|
|
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit lorem ipsum dolor.
|
|
|
|
<strong>Pellentesque risus mi</strong>, tempus quis placerat ut, porta nec
|
|
|
|
nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam,
|
|
|
|
et dictum <a>felis venenatis</a> efficitur.
|
2016-09-11 11:00:49 +00:00
|
|
|
</div>
|
2017-07-29 12:02:00 +00:00
|
|
|
{% endcapture %}
|
2019-03-03 03:49:00 +00:00
|
|
|
{% capture notification_js_html %}
|
|
|
|
<div class="notification">
|
|
|
|
<button class="delete"></button>
|
|
|
|
Lorem ipsum
|
|
|
|
</div>
|
|
|
|
{% endcapture %}
|
|
|
|
{% capture notification_js_code %}
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
(document.querySelectorAll('.notification .delete') || []).forEach(($delete) => {
|
2021-01-27 23:30:42 +00:00
|
|
|
const $notification = $delete.parentNode;
|
2020-01-05 12:56:19 +00:00
|
|
|
|
2019-03-03 03:49:00 +00:00
|
|
|
$delete.addEventListener('click', () => {
|
|
|
|
$notification.parentNode.removeChild($notification);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
{% endcapture %}
|
|
|
|
|
2019-10-13 17:51:12 +00:00
|
|
|
<div class="content">
|
|
|
|
<p>
|
2024-03-21 16:11:54 +00:00
|
|
|
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
|
|
|
|
<code>delete</code> element.
|
2019-10-13 17:51:12 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=notification %}
|
|
|
|
{% include docs/elements/anchor.html name="Colors" %}
|
2017-07-29 12:02:00 +00:00
|
|
|
|
2019-10-13 17:51:12 +00:00
|
|
|
<div class="content">
|
|
|
|
<p>
|
2024-03-21 16:11:54 +00:00
|
|
|
The notification element is available in all the
|
|
|
|
<strong>different colors</strong> defined by the
|
|
|
|
<a href="{{ site.data.links.by_id.customize-variables.path }}"><code>$colors</code> Sass map</a>.
|
2019-10-13 17:51:12 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
2021-01-27 23:30:42 +00:00
|
|
|
{% for color in site.data.colors.justColors %}
|
2024-03-21 16:11:54 +00:00
|
|
|
{% capture foobar %}
|
2021-01-27 23:30:42 +00:00
|
|
|
<div class="notification is-{{ color }}">
|
|
|
|
<button class="delete"></button>
|
2024-03-21 16:11:54 +00:00
|
|
|
Primar lorem ipsum dolor sit amet, consectetur adipiscing elit lorem ipsum
|
|
|
|
dolor. <strong>Pellentesque risus mi</strong>, tempus quis placerat ut, porta
|
|
|
|
nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus
|
|
|
|
diam, et dictum <a>felis venenatis</a> efficitur.
|
2021-01-27 23:30:42 +00:00
|
|
|
</div>
|
|
|
|
{% endcapture %}
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=foobar %}
|
2021-01-27 23:30:42 +00:00
|
|
|
{% endfor %}
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/anchor.html name="Light colors" %}
|
2020-01-05 12:56:19 +00:00
|
|
|
|
2021-01-27 23:30:42 +00:00
|
|
|
<div class="content">
|
2024-03-21 16:11:54 +00:00
|
|
|
Each color also comes in its <strong>light</strong> version. Simply append the <code>is-light</code> modifier to
|
|
|
|
obtain the light version of the notification.
|
2021-01-27 23:30:42 +00:00
|
|
|
</div>
|
2020-01-05 12:56:19 +00:00
|
|
|
|
2021-01-27 23:30:42 +00:00
|
|
|
{% for color in site.data.colors.justColors %}
|
2024-03-21 16:11:54 +00:00
|
|
|
{% capture foobar %}
|
2021-01-27 23:30:42 +00:00
|
|
|
<div class="notification is-{{ color }} is-light">
|
|
|
|
<button class="delete"></button>
|
2024-03-21 16:11:54 +00:00
|
|
|
Primar lorem ipsum dolor sit amet, consectetur adipiscing elit lorem ipsum
|
|
|
|
dolor. <strong>Pellentesque risus mi</strong>, tempus quis placerat ut, porta
|
|
|
|
nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus
|
|
|
|
diam, et dictum <a>felis venenatis</a> efficitur.
|
2021-01-27 23:30:42 +00:00
|
|
|
</div>
|
|
|
|
{% endcapture %}
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/snippet.html content=foobar %}
|
2021-01-27 23:30:42 +00:00
|
|
|
{% endfor %}
|
2024-03-21 16:11:54 +00:00
|
|
|
{% include docs/elements/anchor.html name="JavaScript example" %}
|
2020-01-05 12:56:19 +00:00
|
|
|
|
|
|
|
<div class="content">
|
|
|
|
<p>
|
2024-03-21 16:11:54 +00:00
|
|
|
The Bulma package <strong>does not come with any JavaScript</strong>. Here is however an implementation example,
|
|
|
|
which sets the <code>click</code> handler for Bulma <code>delete</code> elements, anywhere on the page, in vanilla
|
|
|
|
JavaScript.
|
2020-01-05 12:56:19 +00:00
|
|
|
</p>
|
2019-03-03 03:49:00 +00:00
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
{% highlight html -%}
|
|
|
|
{{- notification_js_html -}}
|
|
|
|
{%- endhighlight %}
|
|
|
|
{% highlight javascript -%}
|
|
|
|
{{- notification_js_code -}}
|
|
|
|
{%- endhighlight %}
|
2019-03-03 03:49:00 +00:00
|
|
|
</div>
|
|
|
|
|
2024-03-21 16:11:54 +00:00
|
|
|
|