Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@failed-successfully/ngx-darkbox-gallery

failed-successfully58Apache-2.0 License4.0.0TypeScript support: included

Darkbox Gallery is a highly configurable lightbox themed gallery library for Angular applications using the ivy engine (Angular 18+).

gallery, angular, lightbox-gallery, lightbox, darkbox

readme

Darkbox Gallery

Darkbox Gallery is a highly configurable lightbox themed gallery library for Angular applications using the ivy engine (Angular 18+).


NPM version Downloads PRs Welcome

Darkbox logo

Why?

There are many, many lightbox themed gallery libraries out there for Angular. Some of them are fairly useable, but most lack a good configuration and adaptability. Therefore the philosophy of Darkbox Gallery (Darkbox for short) is to provide good configuration options so you do not need to write extra logic to adapt Darkbox to your needs. While doing so every configuration has useful defaults so the entry barrier for using Darkbox is as low as possible. So come to the dark side of galleries; we don't keep 🍪🍪.

What does it even look like?

If you are not sure what you can expect from Darkbox please have a look at the current version of our live demo.

How?

Installation

Install npm package for Angular version 18+:

npm i @failed-successfully/ngx-darkbox-gallery

Since Version 3 this library is provided as a standalone component. To use it import the NgxDarkboxGalleryComponent into a component of your choice. In this example it is called AppComponent (app.component.ts)

...
import { NgxDarkboxGalleryComponent } from '@failed-successfully/ngx-darkbox-gallery';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss'],
    imports: [NgxDarkboxGalleryComponent]
})
export class AppComponent {
    images: Image[] = [{
        url: 'https://picsum.photos/seed/3000/2000',
        thumbnailUrl: 'https://picsum.photos/300/200'
  }];
}

Usage

The simplest way of using Darkbox is to include the component with its default configuration as shown below.

Inclusion in the desired .html file

<darkbox-gallery [images]="images"/>

For an example of a more advanced Darkbox configuration have a look at our examples.

Darkbox inputs

Name Type Required Description
images Image[] true List of images displayed in Darkbox
configuration Configuration false see Advanced Configuration
loadMoreImagesEvents Observable<void> false Input to handle click events from the outside world

Image

Name Type Required Description
identifier string false An id to identify the image in events. This is not used by the library itself
url string true URL of the full sized image
thumbnailUrl string true URL of the thumbnail image
caption string false A short caption that can be shown under the image in darkbox
altText string false The alternative text shown when the image can not be loaded

Advanced configuration

Please have a look at all available Darkbox configurations in our complete configuration documentation.

Available events

Almost everything that happens in Darkbox triggers an event. Therefore it is easy for you to know what happened when. It is your choice to react to the provides event (e.g. using it to provide statistics). Currently Darkbox exposes the following events:

Name Type Description
imageClicked Image Signals that a single image was clicked. The clicked images is being emitted
thumbnailLoaded Image Signals that a single thumbnail was loaded. The image containing the thumbnail is being emitted
allThumbnailsLoaded boolean Signals that all thumbnails currently displayed have bean loaded
allImagesInDom boolean Signals that all images provided from the input are displayed in the DOM. This does not mean that all thumbnails/images are completely loaded
darkboxClosed boolean Signals that the lightbox/Darkbox was closed by the user
darkboxNext boolean Signals that the user clicked the next image button
darkboxPrev boolean Signals that the user clicked the previous image button
darkboxImageLoaded Image Signals that the full sized images was loaded. The loaded images is being emitted

Browser support

Browser Supported versions
Chrome latest
Firefox latest and extended support release (ESR)
Edge 2 most recent major versions
IE No. It's dead, Jim.
Safari 2 most recent major versions
iOS 2 most recent major versions

Found a bug 🐛/🐞?

If you find a bug in Darkbox please open an issue here so we can fix it and make Darkbox better for you and everyone else.

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

[4.0.0] - 2025-06-08

Added

  • Added compatabilty to angular 20 (#1863)

Changed

  • Update build pipeline to use node 22 (1863#)
  • BREAKING CHANGE: Dropped all unsupported Angular versions. The minimum supported angular version is now 18.x

[3.0.0] - 2024-11-25

Added

  • Added compatabilty to angular 19 (#1609)

Changed

  • Update build pipeline to use node 20 (#1598)
  • BREAKING CHANGE: Migrated the library to use standalone components. Please see the updated inclusion documentation described in the README.md (#1608)

[2.1.0] - 2024-06-18

Added

  • Added compatabilty to angular 18 (#1598)

[2.0.2] - 2024-05-12

  • Update build pipeline to use node 20 and 22
  • Update release pipeline to use node 20
  • Update project dependencies

[2.0.1] - 2023-12-30

Changed

  • Typo in peerDependencies causing resolution issues

Changed

  • Typo in peerDependencies causing resolution issues

[2.0.0] - 2023-12-30

Added

  • Added compatabilty to angular 17 (#1208)

Changed

  • Update build pipeline to use node 20 (#1139)

Removed

  • BREAKING CHANGE: Remove support for Angular <=14. Angular 15 is now the minimum required version.

[1.3.0] - 2023-06-18

Added

  • Added compatabilty to angular 16 (#988, #989)

[1.2.1] - 2022-12-22

Changed

  • Fixed issues with angular peer dependencies (#773, #774)

[1.2.0] - 2022-12-04

Added

  • Added contributer guide (#413, #414)

Changed

  • Update to Angular 15 and made the lib Angular 15 ready (#744)
  • Fixed ugly description on npmjs.com

[1.1.0] - 2022-06-11

Changed

  • Fixed publishing of library to gpr
  • Use a consistent color picker for the demo page (#412, #424)
  • Update node to version 18 (#510, #511)
  • Update to Angular 14 and made the lib Angular 14 ready (#552)

[1.0.0] 2022-02-28

Added

  • Added footer to the demo page (#162. #163)
  • Added prereleases to next tag on npm (#108, #242)
  • Added configuration editor to demo page (#49, #365)
  • Added autmatic release note extraction to workflows (#409)

Changed

  • BREAKING CHANGE: Set angular compiler option to ivy-partial (#161, #257) The minimum supported angular version is now 12.x
  • Updated demo to Angular 13 (#294)
  • Set package version to 1.0.0-branch
  • Updated advanced-configuration-example.md (#157)

Removed

  • Removed unused image-configuration
  • Removed obsolete folder e2e

[0.7.0] - 2021-08-27

Added

  • Added custom swipe implementation based on touch events (#207, #208)
  • Added image caption template system (#6, #154)
  • Added Angular material to the demo page (#212)
  • Added configuration for caption colors (#213, #212)

Changed

  • Fixed issues with pointer on button (#212)
  • Fixed issue with overlay and angular material (z-index issue) (#212)

Removed

  • Removed hammerjs as a peer dependency

[0.6.1] - 2021-06-21

Added

  • Added links in the documentation

Changed

  • Fixed cursor on buttons in the demo (#149, #150)
  • Fixed cursor on buttons in the library (#149, #152)
  • Fixed missing ColorConfiguration export on pulic-api (#151)
  • Fixed issue with z-indices (#155, #156)

[0.6.0] - 2021-06-13

Added

  • Configuration option thumbnailsWaitForBatch to show thumbnails as soon as possible (#146)
  • Configuration options for darkbox button color and styling (#147)
  • Added hammerjs as peerDependency for touch support

Changed

  • Fixed all thumbnails being replaced by loading placeholder while loading a new batch (#138, #146)

[0.5.0] - 2021-06-06

Added

  • Added portrait sample images to demo page (#118)
  • Added automatic labeling of PRs on GitHub (#134)
  • Added event which fires when all images are in the DOM (#127, #128)
  • Added load more button images to the demo (#127, #128)

Changed

  • Fixed incorrect export
  • Changed demo page URL from https://darkbox.failedsuccessfully.de to https://darkbox.click
  • Fixed images overlapping on GridType.FLUID (#136, #137)
  • Moved configuration documentation to its own file so the README isn't to long

[0.4.1] - 2021-05-21

Changed

  • Fixed missing exports in public api
  • Fixed semversion on peer dependencies

[0.4.0] - 2021-05-18

Added

  • Added loading placeholders (#65, #80)
  • Added configuration examples (#4, #68)
  • Added loading animation for full sized images (#95, #96)
  • Added a dark mode to the demo page (#106, #107)

Changed

  • Updated demo page to angular 12 (#103)

[0.3.0] - 2021-04-25

Added

  • Added static grid layout (#11, #78)
  • Added fluid grid layout (#12, #79)

Removed

  • Dropped IE support

[0.3.0] - 2021-04-25

Added

  • Added static grid layout (#11, #78)
  • Added fluid grid layout (#12, #79)

Removed

  • Dropped IE support

[0.2.0] - 2021-04-05

Added

  • Added list of supported browsers (#50)
  • Added links to live demo (#47)
  • Added configuration option to disable the caption (#61)
  • Added documentation for grid configuration (#62)

Changed

  • Updated dependencies (#42, #43, #44, #45, #46, #48, #51, #52, #53, #54, #55, #56, #57, #58, #59, #60, #63, #65)
  • Stop to list non-major dependency updates in changelog

[0.1.2] - 2021-03-16

Added

  • Live demo page (#5. #40)

Fixed

  • Demo page gallery icon (#41)

[0.1.1] - 2021-03-15

Added

  • Set up build pipeline (#23, #24)

Changed

  • Updated dependencies (#21, #22, #25)
  • Updated README.md (#28)

[0.1.0] - 2021-02-27

Added

  • Added most basic lightbox (#17)
  • Configured Renovate Bot for the project (#1)

Changed

  • Updated dependencies (#9, #13, #14, #15)