Skip to content

Lightbox

BsLightbox is a modal image gallery component that is used to display a collection of images and videos.

Updated in v2.2.0

Overview

BsLightbox uses <bs-overlay> component internally and can be closed using the ESC key (enabled by default), or clicking the backdrop (enabled by default). BsLightbox has previous/next controls, indicator and toolbar buttons enabled by default. Data sources is provided via items property. Additionally, you can use arrow key left/right as navigation.

Images and Videos

BsLightbox can also be used to display youtube, video or image. To achieve this, you must set the source type correctly on the Lightbox data source.

Added in v2.2.0

Single Image

BsLightbox can also be used to display single modal image. To achieve this, you have to sets show-counter, show-nav-control, and show-thumbnail property to false. Additionally, you can also sets show-toolbar property to false, if you don't need any toolbar buttons.

Custom Toolbar

BsLightbox toolbar buttons can be customized to some extent. Additionally, you can add custom menus to your needs via menubar slot and enable the menubar button via toolbar property to make the custom menus work correctly. Some buttons do not perform any action, only trigger an event. You must provide your own method for these buttons. The buttons that don't provide any actions are: download, delete and info buttons.

CSS Variables

As CSS technology evolves, Vue MDBootstrap introduces local CSS variables on .md-lightbox-container for better customization.

Updated in v2.2.0
scss
.md-lightbox-container {
  --md-lightbox-element-padding-x: #{vars.$padding-sm};
  --md-lightbox-display-bg: ;
  --md-lightbox-toolbar-bg: #{color.change(colors.$black, $alpha: 0.9)};
  --md-lightbox-toolbar-color: oklch(55.6% 0 89.876);
  --md-lightbox-overlay-bg: oklch(20% 0 0);
  --md-lightbox-title-bg: #{color.change(colors.$black, $alpha: 0.7)};
  --md-lightbox-title-color: oklch(65% 0 0);
  --md-lightbox-title-size: 1.25rem;
  --md-lightbox-thumbnail-bg: #{color.change(colors.$black, $alpha: 0.95)};
  --md-lightbox-thumbnail-border: #{1px solid color.change(colors.$black, $alpha: 0.6)};
  --md-lightbox-thumbnail-opacity: 0.5;
  --md-lightbox-thumbnail-active-border-color: #{colors.$red-base};
  --md-lightbox-thumbnail-active-border-width: 2px;
}

API Reference

Released under the BSD-3-Clause License.