Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created June 8, 2022 12:26
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/5efc95c5c334c4b3b8b3808a0f6c4f09 to your computer and use it in GitHub Desktop.
Save arun12209/5efc95c5c334c4b3b8b3808a0f6c4f09 to your computer and use it in GitHub Desktop.
import { LightningElement } from 'lwc';
import LightningPrompt from 'lightning/prompt';
export default class PromptComponent extends LightningElement {
handlePromptClick() {
LightningPrompt.open({
message: 'this is the prompt message',
//theme defaults to "default"
label: 'Please Respond', // this is the header text
defaultValue: 'initial input value', //this is optional
}).then((result) => {
console.log('Result: '+ result);
//Prompt has been closed
//result is input text if OK clicked
//and null if cancel was clicked
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment