Custom Slides

Yet Another React Lightbox is not limited to just image slides or video slides, and you can render pretty much any supported media via a custom render function.

<Lightbox
    render={{
        slide: (slide) =>
            "type" in slide && slide.type === "custom-slide" ? <MyCustomSlide slide={slide} /> : null
    }}
    //...
/>

Register custom slide type in TypeScript:

interface CustomSlide {
    type: "custom-slide";
    // slide attributes
}

declare module "yet-another-react-lightbox" {
    interface SlideTypes {
        CustomSlide: CustomSlide;
    }
}

Here is an example of a text slide with CSS animation.

Live Demo

CodeSandbox

Edit on CodeSandbox