> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: close(data: object) # Method package: wixWindowFrontend # Method menu location: wixWindowFrontend --> Lightbox --> close # Method Link: https://dev.wix.com/docs/velo/apis/wix-window-frontend/lightbox/close.md # Method Description: Closes a popup. > **Note:** The terms popup and lightbox refer to the same element. While the editor and dashboard now refer to it as a [popup](https://support.wix.com/en/article/studio-editor-using-popups), the API methods continue to use the term lightbox for backward compatibility. The documentation uses both terms accordingly. The `close()` method closes a popup and allows you to pass data from the popup to the page that opened the popup. If a popup is closed through the 'X' icon, close button, or popup overlay, data will not be returned to the original page. To ensure data can be passed: 1. Call this method to close a popup programmatically. For example, add a button with an `onClick` event that calls `close()`. 2. Disable these closing options in the popup's settings under [**Set Triggers**](https://support.wix.com/en/article/studio-editor-using-lightboxes#setting-triggers-for-a-lightbox). # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Close a popup ```javascript import wixWindowFrontend from 'wix-window-frontend'; // ... wixWindowFrontend.lightbox.close(); ``` ## Close a popup and pass back the data ```javascript import wixWindowFrontend from 'wix-window-frontend'; // ... wixWindowFrontend.lightbox.close(dataObj); ``` ## Open and close a popup, and send information between the popup and a page ```javascript /****************** * Home Page Code * ******************/ import { openLightbox } from 'wix-window-frontend'; $w.onReady(() => { $w('#openButton').onClick(async () => { const dataToSend = { greeting: $w('#greeting').value, subject: $w('#subject').value }; const lightBoxResponse = await openLightbox('Greeting Lightbox', dataToSend); $w('#returnedMessage').text = `YOU CHOSE: ${lightBoxResponse}`; $w('#returnedMessage').show(); }); }); /***************** * Lightbox Code * *****************/ import { lightbox } from 'wix-window-frontend'; $w.onReady(function () { let receivedData = lightbox.getContext(); $w('#greeting').text = receivedData.greeting.toUpperCase(); $w('#subject').text = receivedData.subject.toUpperCase(); $w('#blueButton').onClick(clickHandler); $w('#greenButton').onClick(clickHandler); $w('#pinkButton').onClick(clickHandler); }); function clickHandler(event) { lightbox.close(event.target.label); } ``` ## A scenario where information is passed between a page and a popup ```javascript /************* * Page Code * *************/ import wixWindowFrontend from 'wix-window-frontend'; export function openButton_click(event) { wixWindowFrontend.openLightbox("MyLightBox", { "pageSend1": $w('#pageSend1').value, "pageSend2": $w('#pageSend2').value }) .then( (data) => { $w('#pageReceive1').text = data.lightBoxSend1; $w('#pageReceive2').text = data.lightBoxSend2; } ); } /***************** * Lightbox Code * *****************/ import wixWindowFrontend from 'wix-window-frontend'; $w.onReady( function () { let received = wixWindowFrontend.lightbox.getContext(); $w('#lightBoxReceive1').text = received.pageSend1; $w('#lightBoxReceive2').text = received.pageSend2; } ); export function closeButton_click(event) { wixWindowFrontend.lightbox.close( { "lightBoxSend1": $w('#lightBoxSend1').value, "lightBoxSend2": $w('#lightBoxSend2').value } ); } ``` ---