Skip to main content

Control how users clear or dismiss notifications

By default, users click an x in the upper right corner of the notification to clear or dismiss it. Clicking the same x in a notification in Notification Center clears it completely.

Dismissing a notification removes a toast and displays it only in Notification Center. Clearing a notification deletes it entirely from Notification Center. You should be aware of the distinction especially if you set notifications without toasts (that is, only in Notification Center).

Change default notification body interaction

You can override the default behavior and allow the user to dismiss by clicking the body of the notification instead. Add the following to your notification create function:

const notification = 
{
//...
onSelect: {BODY_CLICK: ActionBodyClickType.DISMISS_EVENT}
};

If you add actionable elements to the body of the notification, overriding the default dismiss behavior could create a confusing user experience. See Work with actionable fragments.

See the Notifications API reference documentation for details.