> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - 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:

siteWindow.close(data: object)

# Method Link:

https://dev.wix.com/docs/sdk/frontend-modules/window/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 Permissions:



# Method Permissions Scopes IDs:

undefined



# Method Code Examples:

## Close a lightbox

```javascript
import { lightbox } from '@wix/site-window';

// ...

await lightbox.close();
```

## Close a lightbox and pass back the data

```javascript
import { lightbox } from '@wix/site-window';

// ...

await lightbox.close(dataObj);
```

## A scenario where information is passed between a page and a lightbox

```javascript
/*************
 * Page Code *
 *************/

import { lightbox } from '@wix/site-window';

$w('#myOpenButton').onClick(async (event) => {
  await lightbox.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 { lightbox } from '@wix/site-window';

$w.onReady(async function () {
  let received = await lightbox.getContext();
  $w('#lightBoxReceive1').text = received.pageSend1;
  $w('#lightBoxReceive2').text = received.pageSend2;
} );

$w('#myCloseButton').onClick(async (event) => {
  await lightbox.close( {
    "lightBoxSend1": $w('#lightBoxSend1').value,
    "lightBoxSend2": $w('#lightBoxSend2').value
  } );
} );

```