Display a blocking alert dialog
Shows a modal dialog that blocks user interaction until dismissed. Use this for important messages that require user acknowledgment, such as errors, warnings, or critical information.
The dialog can be customized with an Icon and custom button text. The promise resolves when the user dismisses the dialog.
title of the dialog
message to display in the dialog
Optionaloptions: AlertOptionsoptional configuration for the alert appearance
a promise that will be resolved when the dialog is closed
import { PlatformServiceName } from '@limetech/lime-web-components';
const notifications = platform.get(PlatformServiceName.Notification);
await notifications.alert('Error', 'Something went wrong');
import { PlatformServiceName } from '@limetech/lime-web-components';
const notifications = platform.get(PlatformServiceName.Notification);
await notifications.alert(
'Warning',
'This action may have unintended consequences',
{
icon: {
name: 'warning_shield',
color: 'rgb(var(--color-orange-default))',
},
acceptText: 'I Understand',
}
);
Display a blocking confirm dialog
Shows a modal dialog with accept/cancel buttons for user decisions. Use this before destructive actions, when saving changes, or any time you need explicit user confirmation.
The dialog can be customized with an Icon and custom button labels. The promise resolves to true if the user accepts, false if they cancel.
title of the dialog
message to display in the dialog
Optionaloptions: ConfirmOptionsoptional configuration for button labels and icon
a promise that resolves to true if accepted, false if cancelled
import { PlatformServiceName } from '@limetech/lime-web-components';
const notifications = platform.get(PlatformServiceName.Notification);
const http = platform.get(PlatformServiceName.Http);
const shouldDelete = await notifications.confirm(
'Delete File',
'Are you sure you want to delete this file?'
);
if (shouldDelete) {
await http.delete('my_addon/files/123');
}
import { PlatformServiceName } from '@limetech/lime-web-components';
const notifications = platform.get(PlatformServiceName.Notification);
const navigator = platform.get(PlatformServiceName.Navigator);
const shouldDiscard = await notifications.confirm(
'Unsaved Changes',
'You have unsaved changes. Do you want to discard them?',
{
acceptText: 'Discard',
cancelText: 'Keep Editing',
icon: 'warning_shield',
}
);
if (shouldDiscard) {
navigator.navigate('/');
}
Display a non-blocking notification
Shows a toast-style notification that doesn't block user interaction. Use this for success messages, informational updates, or action feedback. Notifications auto-dismiss after a timeout or can be manually dismissed.
You can optionally add an action button. The promise resolves to true if the action button was clicked, false if the notification was dismissed or timed out.
message to display in the notification
Optionaloptions: NotificationOptionsoptional configuration for timeout, action button, and appearance
a promise that resolves to true if action clicked, false otherwise
import { PlatformServiceName } from '@limetech/lime-web-components';
const notifications = platform.get(PlatformServiceName.Notification);
await notifications.notify('Changes saved successfully');
import { PlatformServiceName } from '@limetech/lime-web-components';
const notifications = platform.get(PlatformServiceName.Notification);
const http = platform.get(PlatformServiceName.Http);
const undoClicked = await notifications.notify('Item deleted', {
actionText: 'Undo',
timeout: 5000,
dismissible: true,
});
if (undoClicked) {
await http.post('my_addon/items/123/restore');
}
Display a non-blocking and non-transient message
Shows a persistent banner notification that remains visible until the user dismisses it or clicks an action. Use this for ongoing status updates, connection issues, or background processes.
Unlike notify(), reports don't auto-dismiss and are more prominent. The promise resolves to true if the action button was clicked, false if the banner was manually dismissed.
message to display in the banner
Optionaloptions: ReportOptionsoptional configuration for action button and icon
a promise that resolves to true if action clicked, false otherwise
import { PlatformServiceName } from '@limetech/lime-web-components';
const notifications = platform.get(PlatformServiceName.Notification);
await notifications.report(
'You are currently offline. Changes will sync when connection is restored.',
{ icon: 'sad_cloud' }
);
import { PlatformServiceName } from '@limetech/lime-web-components';
const notifications = platform.get(PlatformServiceName.Notification);
const http = platform.get(PlatformServiceName.Http);
const cancelled = await notifications.report('Processing 1,234 items...', {
actionText: 'Cancel',
icon: 'hourglass',
});
if (cancelled) {
await http.post('my_addon/jobs/current/stop');
}
Service for displaying different notification messages to users
The Notifications service provides four types of user notifications:
All notification methods return promises, allowing you to handle user interactions asynchronously in your Stencil components.
Use Cases
Example: Simple alert
Example: Confirm before deletion
Example: Success notification with action
Example: Persistent status report