Skip to content
Gravity Logo / Docs Gravity home
Browse documentation
Documentation/Gravity Native

Notification

If you need to display feedback to a user in-app you should use a banner notification. These are perfect for displaying unobtrusive messages at the top of the viewport, such as when a form error occurs or an action has been completed successfully.

Info

If you want to send notifications when the user hasn’t opened your app, you should use a Push Notification.

Showing Banner Notifications

You can show banner notifications from anywhere in your application using the AppContext.

Code

// structure
context.banner.show(message, type, autoclose);

// example
context.banner.show('Saved', 'success', true);
context.banner.hide(); // dismiss manually

Parameters

PropDescriptionRequiredValue
autoclosedetermine if the notification disappears automaticallyoptionalboolean (default: false)
textmessage textrequiredstring
typebanner typerequiredsuccess, error or warning