
Research
TeamPCP-Linked Supply Chain Attack Hits SAP CAP and Cloud MTA npm Packages
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.
@bentoproject/lightbox
Advanced tools
Displays any content in a full-viewport "lightbox" modal.
Displays any content in a full-viewport "lightbox" modal.
You must include each Bento component's required CSS library before adding custom styles in order to guarantee proper loading. Or use the lightweight pre-uprgrade styles available inline. See Layout and Style.
npm install @bentoproject/lightbox
import {defineElement as defineBentoLightbox} from '@bentoproject/lightbox';
defineBentoLightbox();
<script><script type="module" async src="https://cdn.ampproject.org/bento.mjs"></script>
<script nomodule src="https://cdn.ampproject.org/bento.js"></script>
<script type="module" async src="https://cdn.ampproject.org/v0/bento-lightbox-1.0.mjs"></script>
<script nomodule async src="https://cdn.ampproject.org/v0/bento-lightbox-1.0.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.ampproject.org/v0/bento-lightbox-1.0.css">
<!DOCTYPE html>
<html>
<head>
<link
rel="stylesheet"
type="text/css"
href="https://cdn.ampproject.org/v0/bento-lightbox-1.0.css"
/>
<script
type="module"
async
src="https://cdn.ampproject.org/bento.mjs"
></script>
<script nomodule src="https://cdn.ampproject.org/bento.js"></script>
<script
type="module"
async
src="https://cdn.ampproject.org/v0/bento-lightbox-1.0.mjs"
></script>
<script
nomodule
async
src="https://cdn.ampproject.org/v0/bento-lightbox-1.0.js"
></script>
</head>
<body>
<bento-lightbox id="my-lightbox" hidden>
Lightboxed content
<button id="close-button">Close lightbox</button>
</bento-lightbox>
<button id="open-button">Open lightbox</button>
<script>
(async () => {
const lightbox = document.querySelector('#my-lightbox');
await customElements.whenDefined('bento-lightbox');
const api = await lightbox.getApi();
// set up button actions
document.querySelector('#open-button').onclick = () => api.open();
document.querySelector('#close-button').onclick = () => api.close();
})();
</script>
</body>
</html>
Bento components are highly interactive through their API. The bento-lightbox component API is accessible by including the following script tag in your document:
await customElements.whenDefined('bento-lightbox');
const api = await lightbox.getApi();
The amp-lightbox API allows you to perform the following actions:
Opens the lightbox.
api.open();
Closes the lightbox.
api.close();
The amp-lightbox API allows you to register and respond to the following events:
This event is triggered when the lightbox is opened.
lightbox.addEventListener('open', (e) => console.log(e));
This event is triggered when the lightbox is closed.
lightbox.addEventListener('close', (e) => console.log(e));
Each Bento component has a small CSS library you must include to guarantee proper loading without content shifts. Because of order-based specificity, you must manually ensure that stylesheets are included before any custom styles.
<link
rel="stylesheet"
type="text/css"
href="https://cdn.ampproject.org/v0/bento-lightbox-1.0.css"
/>
Alternatively, you may also make the light-weight pre-upgrade styles available inline:
<style>
bento-lightbox {
display: none !important;
}
</style>
idA unique identifier for the lightbox.
hiddenMust be present when the lightbox is closed and the contents should not be displayed, such as on first layout.
animationDefines the style of animation for opening the lightbox. By default, this will be set to fade-in. Valid values are fade-in, fly-in-bottom, and fly-in-top.
scrollableWhen the scrollable attribute is present, the content of the lightbox can scroll when overflowing the height of the lightbox.
<!DOCTYPE html>
<html>
<head>
<link
rel="stylesheet"
type="text/css"
href="https://cdn.ampproject.org/v0/bento-lightbox-1.0.css"
/>
<script
type="module"
async
src="https://cdn.ampproject.org/bento.mjs"
></script>
<script nomodule src="https://cdn.ampproject.org/bento.js"></script>
<script
type="module"
async
src="https://cdn.ampproject.org/v0/bento-lightbox-1.0.mjs"
></script>
<script
nomodule
async
src="https://cdn.ampproject.org/v0/bento-lightbox-1.0.js"
></script>
</head>
<body>
<bento-lightbox id="my-lightbox" hidden>
Lightboxed content
<button id="close-button">Close lightbox</button>
</bento-lightbox>
<button id="open-button">Open lightbox</button>
<script>
(async () => {
const lightbox = document.querySelector('#my-lightbox');
await customElements.whenDefined('bento-lightbox');
const api = await lightbox.getApi();
// set up button actions
document.querySelector('#open-button').onclick = () => api.open();
document.querySelector('#close-button').onclick = () => api.close();
})();
</script>
</body>
</html>
npm install @bentoproject/lightbox
import React from 'react';
import {BentoLightbox} from '@bentoproject/lightbox/react';
import '@bentoproject/lightbox/styles.css';
function App() {
return (
<BentoLightbox
id="lightbox"
closeButtonAs={(props) => (
<button {...props} aria-label="Close my fancy lightbox">
Close!
</button>
)}
>
<p>Hello World</p>
</BentoLightbox>
);
}
The BentoLightbox component has a defined layout size type. To ensure the component renders correctly, be sure to apply a size to the component and its immediate children (slides) via a desired CSS layout (such as one defined with height, width, aspect-ratio, or other such properties). These can be applied inline:
<BentoLightbox style={{width: 300, height: 200}}></BentoLightbox>
Or via className:
<BentoLightbox className="custom-styles"></BentoLightbox>
.custom-styles {
height: 100px;
width: 100%;
}
Animation used to display the lightbox. Options are fade-in, fly-in-top or fly-in-bottom, Default is fade-in.
The content to show within this lightbox.
A prop which takes a function (as a render prop) to specify a custom close button.
A prop which takes a function which is executed before the lightbox is opened.
A prop which takes a function which is executed after the lightbox is opened.
A prop which takes a function which is executed after the lightbox is closed.
FAQs
Displays any content in a full-viewport "lightbox" modal.
We found that @bentoproject/lightbox demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.