You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/design/notifications.rst
+21-22Lines changed: 21 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
Notifications
2
-
=============
2
+
#############
3
3
4
4
Notifications are a critical part of User experience (UX) in digital products, serving as a bridge between the system and the User. They should enhance, not detract from, the experience, assisting Users in achieving their goals and providing immediate, relevant feedback.
5
5
6
6
Notification types and their use
7
-
================================
7
+
********************************
8
8
9
9
Understanding notification variants
10
-
-----------------------------------
10
+
===================================
11
11
12
12
Notifications come in various forms, each serving a specific purpose within an app:
13
13
@@ -18,39 +18,38 @@ Notifications come in various forms, each serving a specific purpose within an a
18
18
- **Actionable notifications**: includes interactive elements and require User interaction. Styled similarly to inline or toast notifications, but more disruptive due to their interactive nature.
19
19
20
20
Design
21
-
------
21
+
======
22
22
23
23
- Carefully examine the context in which notifications appear. Use them sparingly and only when they add value to the User experience.
24
24
- Maintain consistency in the design and behavior of notifications across the app.
25
25
- Be sure to use high-contrast notifications for critical messaging, as low-contrast notifications are less visually disruptive.
26
26
27
27
Content
28
-
-------
28
+
=======
29
29
30
30
- Notifications should be concise and to the point, with a short and descriptive title. Limit the body content to one or two sentences.
31
31
32
32
Actions
33
-
-------
33
+
=======
34
34
35
35
- Limit actionable notifications to one action per notification to avoid overwhelming the User.
36
36
- Inline notifications should persist until dismissed by the User or resolved through an action. Toast notifications can time out but should also include a close button.
37
37
38
38
Accessibility
39
-
-------------
39
+
=============
40
40
41
41
- Notifications should be accessible and not rely solely on color to convey status, as this can be problematic for Users with color blindness, so use additional HTML attributes according to the notification type.
42
42
- Toast notifications with interactive content shouldn't automatically disappear to remain Web Content Accessibility Guidelines 2.1 compliant.
43
43
44
44
.. vale off
45
45
46
46
Using notification Components
47
-
=============================
47
+
*****************************
48
48
49
49
.. vale on
50
50
51
51
Standard notifications with icons
52
-
---------------------------------
53
-
52
+
=================================
54
53
For standard notifications that include an icon, developers should use a ``<div>`` element with the class ``alert`` and an additional class to specify the type of notification:
55
54
56
55
- ``.alert-success`` for success messages
@@ -71,7 +70,7 @@ Example:
71
70
This displays a warning notification with an appropriate icon and color styling.
72
71
73
72
Larger notification blocks without icons
74
-
----------------------------------------
73
+
========================================
75
74
76
75
When you need a larger notification block - for instance to include headings or additional content - developers should use the ``alert`` class along with a column class that starts with the ``col-`` prefix. These notifications don't display an icon but have only a colored left border indicative of the notification type.
77
76
@@ -88,7 +87,7 @@ This creates a more substantial notification block with a heading and paragraph,
88
87
89
88
90
89
Notifications for the notifications panel
91
-
=========================================
90
+
-----------------------------------------
92
91
93
92
The ``NotificationModel`` class in ``NotificationModel.php`` manages notifications under the panel.
94
93
@@ -97,7 +96,7 @@ The ``NotificationModel`` class in ``NotificationModel.php`` manages notificatio
97
96
The system defines the notification template in ``notification.html.twig``.
98
97
99
98
Creating a notification
100
-
-----------------------
99
+
=======================
101
100
102
101
To create a notification, use the ``addNotification`` method of the ``NotificationModel`` class. This method accepts several parameters to customize the notification:
103
102
@@ -120,15 +119,15 @@ To create a notification, use the ``addNotification`` method of the ``Notificati
120
119
All notifications must have a header string defined.
121
120
122
121
Parameters:
123
-
^^^^^^^^^^^
122
+
-----------
124
123
125
-
.. vale of
124
+
.. vale off
126
125
127
126
- ``$message`` string: the main content of the notification.
128
-
- ``$type`` string|null: identifies the source and style of the notification (optional).
129
-
- ``$isRead`` (boolean): indicates if the system has marked the notification as read (default: true).
130
-
- ``$header`` string|null: the header text for the notification (required).
131
-
- ``$iconClass`` string|null: CSS class for the notification icon (for example, 'ri-eye-line').
127
+
- ``$type`` string|null: identifies the source and style of the notification - optional.
128
+
- ``$isRead`` boolean: indicates if the system has marked the notification as read - default: true.
129
+
- ``$header`` string|null: the header text for the notification - required.
130
+
- ``$iconClass`` string|null: CSS class for the notification icon - for example, 'ri-eye-line'.
132
131
- ``$datetime`` \\DateTime|null: creation date of the notification.
133
132
- ``$user`` User|null: the User object associated with the notification defaults to the current User.
134
133
- ``$deduplicateValue`` string|null: used to prevent duplicate notifications within a specified timeframe.
@@ -138,11 +137,11 @@ Parameters:
138
137
139
138
.. note::
140
139
141
-
The header should only contain the translation string; Twig handles the translation.
140
+
The header should only contain the translation string, as Twig handles the translation.
142
141
143
142
144
143
Notification types
145
-
------------------
144
+
==================
146
145
147
146
The ``$type`` parameter determines the visual style of the notification:
148
147
.. vale off
@@ -156,7 +155,7 @@ The ``$type`` parameter determines the visual style of the notification:
156
155
.. vale on
157
156
158
157
Example usage
159
-
-------------
158
+
=============
160
159
161
160
Here's how to create a notification when you schedule a Contact export:
0 commit comments