How to show Pop up window by clicking button?

I want to open pop up window by clicking button ,open modal () method via wix , ref link :
https://www.wix.com/corvid/reference/wix-window/openmodal

import wixWindow from ‘wix-window’;
wixWindow . openModal (“link”, {
“width”: 750 ,
“height”: 500
} )
. then ( () => {
console . log (“Modal closed.”);
} );
Please tell me how to do , clicking on button , it will pop up the link .

You willl need an onClick() event handler for the button. You can do something like this:

$w("#button").onClick( (event) => {
   wixWindow.openModal("link", {"width": 750, "height": 500 })
   .then(() => { console.log("Modal closed."); } );
} );

Many thanks