Notification config
- action
- label
- enable
- notificationHeader
- notificationSubtitle
- emptyMessage
- clearAllMessage
- keepOpen
- clearAllCallback
Notification Config object
The notification config object configures whether or not the notification icon will be shown in the canvas toolbar. It will appear to the far right of the zoom actions in the toolbar. Similar to a toolbar action object, the notificationConfig object looks like this:
const notificationConfig = {action: "notification",label: "Notifications",enable: true,notificationHeader: "Notification Messages",notificationSubtitle: "subtitle",emptyMessage: "You don't have any notifications right now.",clearAllMessage: "Clear all",keepOpen: true,
action
‘notification’ enables the notifications icon to appear in the far right of the toolbar.
label
The Tooltip label to display for the notifications icon in the toolbar.
enable
Icon will have hover effect and is clickable when set to true. If false, icon will be disabled and unclickable. If not set, it will default to disabled (enable: false)
notificationHeader
String to display in the notification panel header. If not set, it will default to “Notifications”.
notificationSubtitle
String to be displayed as a sub-title in the panel header. If not set panel header will be sized to only contain the notificationHeader
string.
emptyMessage
String to be displayed when there are no notification messages to display.
clearAllMessage
String to be displayed on a button displayed at the bottom of the panel. The button can be clicked to clear all the messages from the panel. If omitted the button, and the footer area of the panel it appears in, will not be displayed.
keepOpen
A boolean which indicates when the panel will close. The default is false. If set to false, the panel will close when the user clicks on the page somewhere outside the panel. If set to true the panel will remain open when the user clicks somewhere on the page outside of the panel. With the option the user must click the x
icon in the top right of the panel, or click the notification toolbar icon, to close the panel.
clearAllCallback
An optional callback function that will be called every time the “clear all” button is clicked.
The notification icon state is determined by the type of messages in the notification message array. By default, a notifications icon in ready state will be shown if there are messages in the notification message array. If any message in the array is of type ‘warning’, a notifications icon in warning state will be shown. If any message in the array is of type ‘error’, a notifications icon in error state will be shown. A number will be shown within the notifications icon to indicate the number of messages.
For information about the structure of notification messages, refer to the message specification documentation. Notification messages can be added and removed from the notification panel by calling the canvas controller API. Refer to the canvas controller API documentation for information on how to add/set messages in the notification message array.