Share Plugin
The Share plugin adds a sharing button to the lightbox.
The plugin uses the Web Share API and displays the sharing button in supported browsers.
Documentation
The plugin adds the following Slide
properties.
Property | Type | Description |
---|---|---|
share | boolean | string | { url?: string; text?: string; title?: string } | Sharing props. By default, the plugin uses Use string value to specify custom sharing url. Use object value of the following shape to specify custom props (see Navigator.share() for details):
Use |
Also, the plugin adds the following Lightbox
properties.
Property | Type | Description |
---|---|---|
render | { | Custom render functions:
|
on | { | Lifecycle callbacks.
|
share | { | Share plugin settings.
|
Example
import Lightbox from "yet-another-react-lightbox";
import Share from "yet-another-react-lightbox/plugins/share";
// ...
return (
<Lightbox
slides={[
{ src: "/image1.jpg" },
{ src: "/image2.jpg", share: "/image2.png" },
{
src: "/image3.jpg",
share: { url: "/image3.png", title: "Image title" },
},
]}
plugins={[Share]}
// ...
/>
);