Captions Plugin
Captions plugin allows you to add titles and descriptions to your lightbox slides.
The plugin comes with an additional CSS stylesheet.
import "yet-another-react-lightbox/plugins/captions.css";
Documentation
Captions plugin adds the following Lightbox
properties:
Property | Type | Description |
---|---|---|
captions | { | Captions plugin settings:
Defaults: { descriptionTextAlign: "start", descriptionMaxLines: 3 } |
and the following Slide
properties:
Property | Type | Description |
---|---|---|
title | ReactNode | Slide title. |
description | ReactNode | Slide description. |
Example
import Lightbox from "yet-another-react-lightbox";
import Captions from "yet-another-react-lightbox/plugins/captions";
import "yet-another-react-lightbox/styles.css";
import "yet-another-react-lightbox/plugins/captions.css";
// ...
<Lightbox
open={open}
close={() => setOpen(false)}
slides={[{ src: "/image1.jpg", title: "Slide title", description: "Slide description" }]}
plugins={[Captions]}
/>