Get License
Free
Pro

Lightbox Gallery

Project one or more base-lightbox-thumb images into base-lightbox. Thumb size and aspect ratio are controlled with Tailwind on each image. Click a thumb to open a focus-trapped overlay with flip, rotate, zoom, download, and fullscreen tools.

free

Single image

A single thumb works the same way — no prev/next controls appear. Use Tailwind for ratio and max width on the thumb itself.

Laptop on a wooden desk

HTML

Multi grid (Tailwind size & ratio)

Put layout classes on base-lightbox (applied to the thumbs wrapper). Each thumb keeps its own ratio — square, video, or portrait.

Vintage cameraCamera lensFilm cameraPolaroid cameraPhotography studioCamera on desk

HTML

Mixed ratios

Mix Tailwind aspect utilities on individual thumbs in the same gallery.

Vintage cameraCamera lensFilm camera

HTML

Broken image → alt initials

If a thumb (or the overlay image) fails to load, initials are taken from alt — e.g. "Jane Doe"JD, "Coast"CO. Disable with [initialsFallback]="false" on the thumb or the lightbox.

Jane DoeCoastVintage camera

HTML

Toolbar

Open any gallery above to use the toolbar: horizontal/vertical flip, rotate 90°, zoom in/out (mouse wheel too), download, and browser fullscreen. Keyboard: Esc closes, ←/→ navigate, +/− zoom.

HTML

Installation

Run the following command to add this component to your project:

bash

npx base-ui-cli add lightbox

API Reference

Base UI provides standalone components. Import the exact elements you want to use into your component.

typescript (Example)

import { LightboxComponent, LightboxThumbDirective } from '@lussos/base-ui';

@Component({
  selector: 'app-your-component',
  imports: [
    LightboxComponent,
    LightboxThumbDirective
  ],
  template: `...`
})
export class YourComponent {}

Properties for lightbox — generated from JSDoc in the library source.

API reference for lightbox
SelectorPropertyTypeDefaultDescription
[base-lightbox-thumb]fullSrcstring''Optional full-resolution URL shown in the overlay. Falls back to the element's native `src` (or `imageSrc`) when omitted.
[base-lightbox-thumb]imageSrcstring''Image URL for non-`<img>` hosts. Do **not** use this on `<img>` — bind the native `src` attribute instead so the thumbnail is visible.
[base-lightbox-thumb]imageAltstring''Accessible label override for non-`<img>` hosts. On `<img>`, use native `alt`.
[base-lightbox-thumb]downloadNamestring''Suggested filename for the download action.
[base-lightbox-thumb]initialsFallbackbooleantrueWhen true (default), a broken or missing image is replaced by initials derived from `alt` / `imageAlt` (e.g. "Jane Doe" → "JD").
base-lightboxclassstring''Classes for the thumbs layout wrapper (e.g. `grid grid-cols-3 gap-2`). Applied to an inner container so projected thumbs participate in that layout.
base-lightboxloopbooleantrueWhen true, prev/next wrap around the ends of the gallery.
base-lightboxshowToolbarbooleantrueWhether to show the transform / download toolbar.
base-lightboxshowCounterbooleantrueWhether to show the "n / total" counter when there is more than one image.
base-lightboxcloseOnBackdropbooleantrueClose the overlay when the backdrop is clicked.
base-lightboxdialogLabelunknown'Image lightbox'Accessible name for the lightbox dialog.
base-lightboxinitialsFallbackbooleantrueWhen true (default), a broken or missing viewer image shows initials from the thumb's `alt` / `imageAlt` instead of an empty stage.
base-lightbox(opened)numberEmitted when the lightbox opens, with the active index.
base-lightbox(closed)voidEmitted when the lightbox closes.
base-lightbox(indexChange)numberEmitted whenever the active image index changes while open.

Theme Customizer

Customize your UI instantly.

Primary Color

Border Radius

Background

Mode

Copy these styles to paste into your project's global CSS and Tailwind config.