Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created June 8, 2022 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arun12209/d61795cc318df62eb11f89e75a291c68 to your computer and use it in GitHub Desktop.
Save arun12209/d61795cc318df62eb11f89e75a291c68 to your computer and use it in GitHub Desktop.
import { LightningElement } from 'lwc';
import LightningAlert from 'lightning/alert'; //this module needs to import.
export default class AlertComponent extends LightningElement {
async handleAlertClick() {
await LightningAlert.open({
message: 'This is the alert message from LWC',
theme: 'error', // a red theme intended for error states
label: 'Error!', // this is the header text
});
//Alert has been closed
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment