<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Michele</title>
    <description>The latest articles on Forem by Michele (@michelecocuccio).</description>
    <link>https://forem.com/michelecocuccio</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F280123%2F13a3f210-cf0b-42ce-848f-a733658cd23d.jpeg</url>
      <title>Forem: Michele</title>
      <link>https://forem.com/michelecocuccio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/michelecocuccio"/>
    <language>en</language>
    <item>
      <title>How to easily add a lightbox in any React project</title>
      <dc:creator>Michele</dc:creator>
      <pubDate>Tue, 15 Dec 2020 22:01:05 +0000</pubDate>
      <link>https://forem.com/michelecocuccio/simple-react-lightbox-m6o</link>
      <guid>https://forem.com/michelecocuccio/simple-react-lightbox-m6o</guid>
      <description>&lt;h4&gt;
  
  
  A simple but functional lightbox for React
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://github.com/michelecocuccio/simple-react-lightbox" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; | &lt;a href="https://simple-react-lightbox.dev" rel="noopener noreferrer"&gt;Official Website&lt;/a&gt; | &lt;a href="https://codesandbox.io/s/simple-react-lightboxss-39wrb" rel="noopener noreferrer"&gt;CodeSandbox Demo&lt;/a&gt; | &lt;a href="https://demo.simple-react-lightbox.dev" rel="noopener noreferrer"&gt;PRO version demo&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  A brief introduction 🧐
&lt;/h4&gt;

&lt;p&gt;It all started when I was working on one of my projects with React. The client had a blog site and wanted to add a lightbox to the images in the blog posts. The problem was that the data was fetched from the backend and I had no control over the content of each post.&lt;/p&gt;

&lt;p&gt;I looked online for some lightboxes for React, but the way they worked was that I had to declare the images beforehand either in an array, an object, etc… but what if you do not know what content you are getting and you just want to add a lightbox to the images in the content?&lt;/p&gt;

&lt;p&gt;Simple React Lightbox gives you the ability to add lightbox functionality to a set of images, whether you define it yourself or get it from an external source (API, backend, etc…). Just use the included component to wrap your app with it, define your options (if you want) and then use the "" component by wrapping it around the content where you have or expect your images!&lt;/p&gt;

&lt;h4&gt;
  
  
  Packed with features 📦
&lt;/h4&gt;

&lt;p&gt;Since the first version came out, I added tons of new and useful features. Also the &lt;a href="https://simple-react-lightbox.dev" rel="noopener noreferrer"&gt;&lt;strong&gt;PRO version&lt;/strong&gt;&lt;/a&gt; adds even more features. Some of the features are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Image validation (if you have a broken image, it will be ignored by the lightbox).&lt;/li&gt;
&lt;li&gt;Audio e Video support &lt;a href="https://simple-react-lightbox.dev" rel="noopener noreferrer"&gt;&lt;strong&gt;(PRO ONLY)&lt;/strong&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Exclude elements with a simple custom HTML attribute &lt;a href="https://simple-react-lightbox.dev" rel="noopener noreferrer"&gt;&lt;strong&gt;(PRO ONLY)&lt;/strong&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Custom icons and custom captions &lt;a href="https://simple-react-lightbox.dev" rel="noopener noreferrer"&gt;&lt;strong&gt;(PRO ONLY)&lt;/strong&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Support for NextJS and Gatsby and support for Gatsby images.&lt;/li&gt;
&lt;li&gt;Observable to check if more images are loaded (for example from an API).&lt;/li&gt;
&lt;li&gt;Translations (i18n compatible) to translate the icons using your preferred language &lt;a href="https://simple-react-lightbox.dev" rel="noopener noreferrer"&gt;&lt;strong&gt;(PRO ONLY)&lt;/strong&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Callbacks to get the status of the lightbox including counting how many images it holds, which slide is selected and which slides comes before and after the current one.
*Hooks! One for opening the lightbox (from the first image or passing and index) and one for closing the lightbox.&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  Install
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// With npm
npm install --save simple-react-lightbox
// or with Yarn
yarn add simple-react-lightbox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  Usage
&lt;/h4&gt;

&lt;p&gt;I have provided a &lt;a href="https://codesandbox.io/s/simple-react-lightboxss-39wrb" rel="noopener noreferrer"&gt;demo on CodeSandbox&lt;/a&gt; for you to play with or you can just follow the instructions below. Alternatively, you can try the full demo with the &lt;a href="https://simple-react-lightbox.dev" rel="noopener noreferrer"&gt;PRO version&lt;/a&gt; on &lt;a href="https://demo.simple-react-lightbox.dev" rel="noopener noreferrer"&gt;the official website&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Instructions
&lt;/h4&gt;

&lt;p&gt;First of all you need to "wrap" your React app with the main component so that it can create the context. The example below will allow you to use the Simple React Lightbox wherever you need it in your app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import MyComponent from "./components/MyComponent";
import SimpleReactLightbox from "simple-react-lightbox"; 
// Import Simple React Lightbox
function App() {
  return (
    &amp;lt;div className="App"&amp;gt;
      &amp;lt;SimpleReactLightbox&amp;gt;
        &amp;lt;MyComponent /&amp;gt; // Your App logic (Components, Router etc...)
      &amp;lt;/SimpleReactLightbox&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
export default App;
```

`
Next you want to import and use the SRLWrapper component wherever you expect the content with the images on which you want to add the lightbox functionality. Please note the {} as this is a named export. The caption for the images will be generated from the image "alt" attribute!

`

```
import React from "react";
import { SRLWrapper } from "simple-react-lightbox"; // Import SRLWrapper
function MyComponent() {
  return (
      &amp;lt;SRLWrapper&amp;gt;
        // This will be your content with the images. It can be anything. Content defined by yourself, content fetched from an API, data from a graphQL query... anything :)
      &amp;lt;/SRLWrapper&amp;gt;
  );
}
export default MyComponent;
```

`
That's it 🥳 As we are not passing any options you should have a working lightbox with the default options like the image below:
![The lightbox with default options](https://simple-react-lightbox.dev/docs/SRL_Example1_Git.jpeg)


#### Options
I know what you are thinking.

&amp;gt;"That's cool and all but the style of the lightbox doesn't match the one of my project. That's ok though. I will use your classes and override everything with my custom styles…"

⚠️ WAIT! ⚠️ Despite the fact that I have made sure to define class names for each part of the lightbox, I have provided all the options that you need to customise the lightbox so that you don't have to add any additional logic. You can customise everything! Check how to add options on the options on the GitHub repo.
The lightbox with custom options
![The lightbox with custom options](https://simple-react-lightbox.dev/docs/SRL_Example2_Git.jpeg)

---

That's it! I hope you enjoy Simple React Lightbox and keep following the project as I am planning to add more features in the future.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Simple-React-Lightbox, a simple but functional light-box for React.</title>
      <dc:creator>Michele</dc:creator>
      <pubDate>Thu, 07 May 2020 20:59:31 +0000</pubDate>
      <link>https://forem.com/michelecocuccio/simple-react-lightbox-a-simple-but-functional-light-box-for-react-36i8</link>
      <guid>https://forem.com/michelecocuccio/simple-react-lightbox-a-simple-but-functional-light-box-for-react-36i8</guid>
      <description>&lt;h3&gt;
  
  
  Github
&lt;/h3&gt;

&lt;p&gt;Check the project on Github to read the full documentation&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/michelecocuccio"&gt;
        michelecocuccio
      &lt;/a&gt; / &lt;a href="https://github.com/michelecocuccio/simple-react-lightbox"&gt;
        simple-react-lightbox
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A simple but functional light-box for React.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Simple React Light-box (SRL)&lt;/h1&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://camo.githubusercontent.com/2eeca20ce3234bc16b142ca90536dc13f409670d0e92bcd29aac08a80074082f/68747470733a2f2f73696d706c652d72656163742d6c69676874626f782e6465762f646f63732f53524c5f4c6f676f5f4769742e6a7065673f"&gt;&lt;img src="https://camo.githubusercontent.com/2eeca20ce3234bc16b142ca90536dc13f409670d0e92bcd29aac08a80074082f/68747470733a2f2f73696d706c652d72656163742d6c69676874626f782e6465762f646f63732f53524c5f4c6f676f5f4769742e6a7065673f" alt="Simple React Light-box - Logo"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.npmjs.com/package/simple-react-lightbox" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/32c07100b303905445d478ed1a2c38a086674faaa817c5ecb49f49be6a1449b6/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f73696d706c652d72656163742d6c69676874626f782e737667" alt="NPM"&gt;&lt;/a&gt; &lt;a href="https://standardjs.com" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/bde227e3207c7143032c0feb73889ffbda8eb1ef234b820b915ccaf74f9c66d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64655f7374796c652d7374616e646172642d627269676874677265656e2e737667" alt="JavaScript Style Guide"&gt;&lt;/a&gt; &lt;a href="https://travis-ci.com/michelecocuccio/simple-react-lightbox" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/4036f6d6cb603eaf0ae211c396da2ea4c0c820db47038138435aefaa5c790e7f/68747470733a2f2f7472617669732d63692e636f6d2f6d696368656c65636f63756363696f2f73696d706c652d72656163742d6c69676874626f782e7376673f746f6b656e3d5279744b4c42676159737a635232357a365a4c50266272616e63683d6d6173746572" alt="Build Status"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;amp;hosted_button_id=846H2KJ6AUL48" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/57189f97efb9d0fa07f805498ac48de76937cc4c602a647d6d81d0d7ca9265c7/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f656e5f47422f692f62746e2f62746e5f646f6e6174655f4c472e676966" alt="paypal"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.buymeacoffee.com/michelecocuccio" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/c3f856bacd5b09669157ed4774f80fb9d8622dd45ce8fdf2990d3552db99bd27/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f6f72616e67655f696d672e706e67" alt="buymeacoffe"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
Documentation: quick links&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#a-brief-introduction"&gt;A brief introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#demo"&gt;Demo on CodeSandbox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#how-to-use"&gt;Get started&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#options"&gt;Options&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#custom-captions"&gt;Custom Captions&lt;/a&gt; 🆕
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#callbacks"&gt;Callbacks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#hooks"&gt;Custom Hook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#firefox-issue"&gt;A note on "slide" animation and Firefox&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
August updates and bugfixes (v3.3)&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#translations-options"&gt;Translations&lt;/a&gt; has been added to the list of options&lt;/strong&gt;. Now you can change the title of the buttons with the text that you want and you can translate it to your preferred language.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Full screen mode has been improved&lt;/strong&gt;. Now you can use the interface of Simple React Lightbox while being on full screen.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fixed a bug that was causing the image to shake when panning and zooming on IOS.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fixed a bug that was causing the thumbnails to wrongly position themself on IOS.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fixed a bug that was causing the light-box to be unable to recognize the source of the image when using Gatsby image with the "Gallery with thumbnails" mode.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fixed a…&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/michelecocuccio/simple-react-lightbox"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  A brief introduction 🧐
&lt;/h3&gt;

&lt;p&gt;It all started when I was working on one of my project using React. The client had a blog page and he wanted to add a light-box to the images in the blog posts. The problem is that the data was fetched from the backend and I had no control over the content of each post (the content was in a WYSIWYG editor).&lt;/p&gt;

&lt;p&gt;I checked online for some light-box for React but the way that they were working was that I had to declare the images beforehand in either an array, an object etc...but what if you don't know about the content and you just want to add a light-box to the images? 😞&lt;/p&gt;

&lt;h3&gt;
  
  
  My Idea 💡
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Simple React Lightbox&lt;/strong&gt; gives you the ability to add a light-box functionality on a set of images, whether you define them yourself or you get them from an external source (API, backend etc…). Just use the provided component to wrap your app, define your options and then use the "SRLWrapper" component by wrapping it around the content in which you have or expect your images 😮! It takes less than 1 minute to implement it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Each light-box is individually configurable&lt;/strong&gt; both in terms of styles and options. That means that you can easily adapt the style of the light-box to your project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Packed with features 📦
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Simple React Lightbox&lt;/strong&gt; comes with many features: please check the &lt;a href="https://github.com/michelecocuccio/simple-react-lightbox#options"&gt;options&lt;/a&gt; section to see the full list of options. Since the first version came out, I added tons of new and useful features. The most recent one includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Image validation (if you have a broken image, it will be ignored by the light-box).&lt;a href="https://dev.to/new"&gt;https://dev.to/new&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Support for NextJS and Gatsby and support for Gatsby images.&lt;/li&gt;
&lt;li&gt;Observable to check if more images are loaded (for example from an API).&lt;/li&gt;
&lt;li&gt;Callbacks to help you in case the user needs to get the status of the light-box including counting how many images it holds, which slide is selected and which slides comes before and after the current one.&lt;/li&gt;
&lt;li&gt;New and redesigned options, to make your code cleaner and more readable and to make the light-box easier to use.&lt;/li&gt;
&lt;li&gt;Hooks! One for opening the light-box (from the first image or passing and index) and one for closing the light-box.&lt;/li&gt;
&lt;li&gt;Many more…
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wM-Mha0e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/d5ub389jdcjierjqtrln.jpeg" alt="Simple React Lightbox - Features"&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Demo
&lt;/h3&gt;

&lt;p&gt;I have provided a working demo on CodeSandbox where you can also play with the options and see the light-box in action. This is the same as running the demo locally. Alternatively, you can play with a demo on the official website of &lt;a href="https://www.simple-react-lightbox.dev/"&gt;Simple-React-Lightbox&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codesandbox.io/s/simple-react-lightboxss-39wrb?fontsize=10"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pzpI10jk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codesandbox.io/static/img/play-codesandbox.svg" alt="Edit Simple-React-Lightbox§"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to use
&lt;/h3&gt;

&lt;p&gt;First of all you need to &lt;strong&gt;wrap your React app with the main component&lt;/strong&gt; so that it can create the context. The example below will allow you to use the &lt;strong&gt;Simple React Lightbox&lt;/strong&gt; wherever you need it in your app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./components/MyComponent&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Import Simple React Lightbox&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;SimpleReactLightbox&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;simple-react-lightbox&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"App"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      // Wrap your app with the component
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;SimpleReactLightbox&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;MyComponent&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt; // Your App logic
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;SimpleReactLightbox&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Note: &lt;em&gt;if you need multiple instance of the light-box in one page you should wrap each one in it's own  &lt;code&gt;&amp;lt;SimpleReactLightbox&amp;gt;&lt;/code&gt; component.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Next you want to import and use the &lt;code&gt;&amp;lt;SRLWrapper&amp;gt;&lt;/code&gt; component wherever you expect the content with the images on which you want to add the light-box functionality. Please note the &lt;code&gt;{}&lt;/code&gt; as this is a named export. The caption for the images will be generated from the &lt;a href="https://www.w3schools.com/tags/tag_img.asp"&gt;image "alt" attribute&lt;/a&gt; so don't forget to add it.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Import SRLWrapper&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;SRLWrapper&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;simple-react-lightbox&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"MyComponent"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;SRLWrapper&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        // This will be your content with the images. It can be anything. Content defined by yourself, content fetched from an API, data from a graphQL query... anything :)
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;SRLWrapper&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That's it 🥳 As we are not passing any options you should have a working light-box with the default options like the image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C4oh4KqY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://simple-react-lightbox.dev/docs/SRL_Example1_Git.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C4oh4KqY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://simple-react-lightbox.dev/docs/SRL_Example1_Git.jpeg" alt="Simple React Lightbox - Default options"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h6&gt;
  
  
  The light-box with the default options
&lt;/h6&gt;
&lt;h3&gt;
  
  
  Custom gallery
&lt;/h3&gt;

&lt;p&gt;If you want to use the light-box in a more traditional way, like if you want to create a gallery in which thumbnails are wrapped in a link that links to a full width image, now you can. Check the "Gallery with links" example page on the CodeSandbox demo.&lt;/p&gt;

&lt;p&gt;Simply wrap your images (ideally the thumbnails) in a link with the &lt;strong&gt;&lt;code&gt;data-attribute="SRL"&lt;/code&gt;&lt;/strong&gt;. As usual, the &lt;code&gt;alt&lt;/code&gt; attribute for the images will be used as caption if declared.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Import SRLWrapper&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;SRLWrapper&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;simple-react-lightbox&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"MyComponent"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;SRLWrapper&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"link/to/the/full/width/image.jpg"&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="err"&gt;-&lt;/span&gt;&lt;span class="na"&gt;attribute&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"SRL"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;img&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"src/for/the/thumbnail/image.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Umbrella"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"link/to/the/full/width/image_two.jpg"&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="err"&gt;-&lt;/span&gt;&lt;span class="na"&gt;attribute&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"SRL"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;img&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"src/for/the/thumbnail/image_two.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Whatever"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;SRLWrapper&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Options
&lt;/h4&gt;

&lt;p&gt;Passing options is very simple. Just pass the options in a prop called &lt;strong&gt;options&lt;/strong&gt; to the &lt;code&gt;&amp;lt;SRLWrapper&amp;gt;&lt;/code&gt; component. I will strongly recommend to create a constant with all the options and then pass it to the component. &lt;strong&gt;From version 2.8, options are divided in four objects to avoid confusion and to make the code cleaner&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The four objects are: &lt;code&gt;settings&lt;/code&gt;, &lt;code&gt;caption&lt;/code&gt;, &lt;code&gt;buttons&lt;/code&gt;, &lt;code&gt;thumbnails&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
  &lt;span class="na"&gt;caption&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
  &lt;span class="na"&gt;buttons&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
  &lt;span class="na"&gt;thumbnails&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./components/MyComponent&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Import SRLWrapper&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;SRLWrapper&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;simple-react-lightbox&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Create an object with the options that you want to use. The options are divided in 4 main objects. You don't need to define them all.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;overlayColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rgb(25, 136, 124)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;autoplaySpeed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;transitionSpeed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;900&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;buttons&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#1b5245&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;iconColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rgba(126, 172, 139, 0.8)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;caption&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;captionColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#a6cfa5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;captionFontFamily&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Raleway, sans-serif&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;captionFontWeight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;300&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;captionTextTransform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;uppercase&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"MyComponent"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
     // Simply pass the entire object in a prop called "options"
     &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;SRLWrapper&lt;/span&gt; &lt;span class="na"&gt;options&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        // Your images here
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;SRLWrapper&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hfxanc2r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/c96wyh7kmnw1lm0gp2xo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hfxanc2r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/c96wyh7kmnw1lm0gp2xo.png" alt="light-box with custom options"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  There is more to discover
&lt;/h3&gt;

&lt;p&gt;Please check the project on Github to read the full documentation and to get a full list of the options available.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/michelecocuccio"&gt;
        michelecocuccio
      &lt;/a&gt; / &lt;a href="https://github.com/michelecocuccio/simple-react-lightbox"&gt;
        simple-react-lightbox
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A simple but functional light-box for React.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Simple React Light-box (SRL)&lt;/h1&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://camo.githubusercontent.com/2eeca20ce3234bc16b142ca90536dc13f409670d0e92bcd29aac08a80074082f/68747470733a2f2f73696d706c652d72656163742d6c69676874626f782e6465762f646f63732f53524c5f4c6f676f5f4769742e6a7065673f"&gt;&lt;img src="https://camo.githubusercontent.com/2eeca20ce3234bc16b142ca90536dc13f409670d0e92bcd29aac08a80074082f/68747470733a2f2f73696d706c652d72656163742d6c69676874626f782e6465762f646f63732f53524c5f4c6f676f5f4769742e6a7065673f" alt="Simple React Light-box - Logo"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.npmjs.com/package/simple-react-lightbox" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/32c07100b303905445d478ed1a2c38a086674faaa817c5ecb49f49be6a1449b6/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f73696d706c652d72656163742d6c69676874626f782e737667" alt="NPM"&gt;&lt;/a&gt; &lt;a href="https://standardjs.com" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/bde227e3207c7143032c0feb73889ffbda8eb1ef234b820b915ccaf74f9c66d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64655f7374796c652d7374616e646172642d627269676874677265656e2e737667" alt="JavaScript Style Guide"&gt;&lt;/a&gt; &lt;a href="https://travis-ci.com/michelecocuccio/simple-react-lightbox" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/4036f6d6cb603eaf0ae211c396da2ea4c0c820db47038138435aefaa5c790e7f/68747470733a2f2f7472617669732d63692e636f6d2f6d696368656c65636f63756363696f2f73696d706c652d72656163742d6c69676874626f782e7376673f746f6b656e3d5279744b4c42676159737a635232357a365a4c50266272616e63683d6d6173746572" alt="Build Status"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;amp;hosted_button_id=846H2KJ6AUL48" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/57189f97efb9d0fa07f805498ac48de76937cc4c602a647d6d81d0d7ca9265c7/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f656e5f47422f692f62746e2f62746e5f646f6e6174655f4c472e676966" alt="paypal"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.buymeacoffee.com/michelecocuccio" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/c3f856bacd5b09669157ed4774f80fb9d8622dd45ce8fdf2990d3552db99bd27/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f6f72616e67655f696d672e706e67" alt="buymeacoffe"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
Documentation: quick links&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#a-brief-introduction"&gt;A brief introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#demo"&gt;Demo on CodeSandbox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#how-to-use"&gt;Get started&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#options"&gt;Options&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#custom-captions"&gt;Custom Captions&lt;/a&gt; 🆕
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#callbacks"&gt;Callbacks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#hooks"&gt;Custom Hook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#firefox-issue"&gt;A note on "slide" animation and Firefox&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
August updates and bugfixes (v3.3)&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#translations-options"&gt;Translations&lt;/a&gt; has been added to the list of options&lt;/strong&gt;. Now you can change the title of the buttons with the text that you want and you can translate it to your preferred language.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Full screen mode has been improved&lt;/strong&gt;. Now you can use the interface of Simple React Lightbox while being on full screen.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fixed a bug that was causing the image to shake when panning and zooming on IOS.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fixed a bug that was causing the thumbnails to wrongly position themself on IOS.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fixed a bug that was causing the light-box to be unable to recognize the source of the image when using Gatsby image with the "Gallery with thumbnails" mode.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fixed a…&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/michelecocuccio/simple-react-lightbox"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;



</description>
      <category>react</category>
      <category>javascript</category>
      <category>galley</category>
      <category>images</category>
    </item>
    <item>
      <title>Simple React light-box</title>
      <dc:creator>Michele</dc:creator>
      <pubDate>Tue, 26 Nov 2019 11:19:32 +0000</pubDate>
      <link>https://forem.com/michelecocuccio/simple-react-light-box-2hb5</link>
      <guid>https://forem.com/michelecocuccio/simple-react-light-box-2hb5</guid>
      <description>&lt;h3&gt;
  
  
  Github
&lt;/h3&gt;

&lt;p&gt;Check the project on Github to read the full documentation&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/michelecocuccio"&gt;
        michelecocuccio
      &lt;/a&gt; / &lt;a href="https://github.com/michelecocuccio/simple-react-lightbox"&gt;
        simple-react-lightbox
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A simple but functional light-box for React.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Simple React Light-box (SRL)&lt;/h1&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://camo.githubusercontent.com/6c55859236ba11cfe123ab17bd6abac8304467c7/68747470733a2f2f73696d706c652d72656163742d6c69676874626f782e6465762f646f63732f53524c5f4c6f676f5f4769742e6a7065673f"&gt;&lt;img src="https://camo.githubusercontent.com/6c55859236ba11cfe123ab17bd6abac8304467c7/68747470733a2f2f73696d706c652d72656163742d6c69676874626f782e6465762f646f63732f53524c5f4c6f676f5f4769742e6a7065673f" alt="Simple React Light-box - Logo"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.npmjs.com/package/simple-react-lightbox" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/b59a1c46cc64c5116a776cc6753634b4d38aac76/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f73696d706c652d72656163742d6c69676874626f782e737667" alt="NPM"&gt;&lt;/a&gt; &lt;a href="https://standardjs.com" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/58fbab8bb63d069c1e4fb3fa37c2899c38ffcd18/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64655f7374796c652d7374616e646172642d627269676874677265656e2e737667" alt="JavaScript Style Guide"&gt;&lt;/a&gt; &lt;a href="https://travis-ci.com/michelecocuccio/simple-react-lightbox" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/6b29e80cb7796ad801706aa294d7db0fe8c9d6f7/68747470733a2f2f7472617669732d63692e636f6d2f6d696368656c65636f63756363696f2f73696d706c652d72656163742d6c69676874626f782e7376673f746f6b656e3d5279744b4c42676159737a635232357a365a4c50266272616e63683d6d6173746572" alt="Build Status"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;amp;hosted_button_id=846H2KJ6AUL48" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/1d4c796d0043ba18176a68767c2ee55188d55cc1/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f656e5f47422f692f62746e2f62746e5f646f6e6174655f4c472e676966" alt="paypal"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
Documentation: quick links&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#a-brief-introduction"&gt;A brief introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#demo"&gt;Demo on CodeSandbox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#how-to-use"&gt;Get started&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#options"&gt;Options&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#custom-captions"&gt;Custom Captions&lt;/a&gt; 🆕
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#callbacks"&gt;Callbacks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#hooks"&gt;Custom Hook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#firefox-issue"&gt;A note on "slide" animation and Firefox&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
What's new in Version 3.0&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;⚠️ &lt;strong&gt;HEADS UP!&lt;/strong&gt; The value for the following options in the settings object have been changed from milliseconds to seconds. &lt;code&gt;slideTransitionSpeed&lt;/code&gt;,&lt;code&gt;lightboxTransitionSpeed&lt;/code&gt;. If you see a really slow animation is likely because you have forget to change the value. ⚠️&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;🆕 (added in 3.1) Custom captions are now a thing. I have listened to some feedbacks and now you can make a custom caption with HTML markup and add it to a specific image. Read carefully the documentation on &lt;a href="https://raw.githubusercontent.com/michelecocuccio/simple-react-lightbox/master/#custom-captions"&gt;custom captions&lt;/a&gt; to see how to use it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;New physics animations for the light-box have been added for realistic motion. The images can now have a "slide" animation where they slide left and right. They…&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/michelecocuccio/simple-react-lightbox"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  A brief introduction 🧐
&lt;/h3&gt;

&lt;p&gt;It all started when I was working on one of my project using React. The client had a blog page and he wanted to add a light-box to the images in the blog posts. The problem is that the data was fetched from the backend and I had no control over the content of each post (the content was in a WYSIWYG editor).&lt;/p&gt;

&lt;p&gt;I checked online for some light-box for React but the way that they were working was that I had to declare the images beforehand in either an array, an object etc...but what if you don't know about the content and you just want to add a light-box to the images? 😞&lt;/p&gt;

&lt;h3&gt;
  
  
  My Idea 💡
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Simple React Lightbox&lt;/strong&gt; gives you the ability to add a light-box functionality on a set of images, whether you define them yourself or you get them from an external source (API, backend etc…). Just use the provided component to wrap your app, define your options and then use the "SRLWrapper" component by wrapping it around the content in which you have or expect your images 😮! It takes less than 1 minute to implement it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Each light-box is individually configurable&lt;/strong&gt; both in terms of styles and options. That means that you can easily adapt the style of the light-box to your project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Packed with features 📦
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Simple React Lightbox&lt;/strong&gt; comes with many features: please check the &lt;a href="https://github.com/michelecocuccio/simple-react-lightbox#options"&gt;options&lt;/a&gt; section to see the full list of options. Some features are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PanZoom: allows to zoom on an image and drag it to see all the hidden details!&lt;/li&gt;
&lt;li&gt;Autoplay: allows to automatically go to the next image after a set amount of time (which can be configured)&lt;/li&gt;
&lt;li&gt;Image validation: excludes broken images so that they will be ignored by the light-box (if you click on a broken images the light-box won't open)&lt;/li&gt;
&lt;li&gt;Fully customisable: buttons, caption and background colour can be fully customised&lt;/li&gt;
&lt;li&gt;Naturally responsive: Simple React light-box is responsive and supports touch controls. I have also provided clear class names for each part of the light-box in case you need more granular control.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wM-Mha0e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/d5ub389jdcjierjqtrln.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wM-Mha0e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/d5ub389jdcjierjqtrln.jpeg" alt="Simple React Lightbox - Features"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Demo
&lt;/h3&gt;

&lt;p&gt;I have provided a working demo on CodeSandbox where you can also play with the options and see the light-box in action. This is the same as running the demo locally.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codesandbox.io/s/simple-react-lightboxss-39wrb?fontsize=10"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pzpI10jk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codesandbox.io/static/img/play-codesandbox.svg" alt="Edit Simple-React-Lightbox§"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Images
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xmUs-2A3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2xzehu54wyd7ijm79d4b.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xmUs-2A3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2xzehu54wyd7ijm79d4b.jpeg" alt="Default light-box without options"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5yi1Lamy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mgb6qa8o6lrs9340icik.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5yi1Lamy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mgb6qa8o6lrs9340icik.png" alt="light-box with custom options"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hfxanc2r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/c96wyh7kmnw1lm0gp2xo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hfxanc2r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/c96wyh7kmnw1lm0gp2xo.png" alt="light-box with custom options"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>github</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
