Inline Plugin

Inline plugin adds support for inline lightbox rendering mode. Instead of being opened in a portal, the lightbox can be rendered inline in the document.

Documentation

The plugin adds and overrides the following Lightbox properties.

PropertyTypeDescription
inlineReact.HTMLAttributes​<HTMLDivElement>

HTML div element attributes to be passed to the Inline plugin container

Defaults: { style: { width: "100%", height: "100%" } }

opentrueThis prop is ignored.
close() => {}This prop is ignored.
controller.focusfalseThis prop is ignored.
toolbar.buttons(React.ReactNode | "close")[]The "close" button is ignored.

Example

import Lightbox from "yet-another-react-lightbox";
import Inline from "yet-another-react-lightbox/plugins/inline";
import "yet-another-react-lightbox/styles.css";

// ...

<div style={{ width: "100%", maxWidth: "900px", aspectRatio: "3 / 2" }}>
    <Lightbox slides={slides} plugins={[Inline]} />
</div>

// or

<Lightbox
    slides={slides}
    inline={{ style: { width: "100%", maxWidth: "900px", aspectRatio: "3 / 2" } }}
    plugins={[Inline]}
/>

Live Demo

CodeSandbox

Edit on CodeSandbox