Home

Awesome

Ngx Simple Gallery

npm version codecov

A simple gallery lib for Angular [18]. It displays all the images as thumbnails and makes it big, when clicked/tapped on it.

Demo

Installation

npm install --save ngx-simple-gallery @angular/cdk

add the following line to your global styles (by default "styles.(scss|css)") if it is not included yet:

@import '@angular/cdk/overlay-prebuilt.css';

Versioning

GalleryAngularReadme
<=1.x.x>=18here

Usage

1. Import the gallery into your component

import { NgxSimpleGalleryComponent } from '@zolcsi/ngx-simple-gallery';

@Component({
  standalone: true,
  imports: [NgxSimpleGalleryComponent],
})
export class AppComponent {}

2. List the gallery items

import { GalleryItem } from '@zolcsi/ngx-simple-gallery';

@Component({...})
export class AppComponent {
  galleryItems: GalleryItem[] = [
    { 
      src: '/img/image1.jpg' 
    }, 
    {
      src: 'https://picsum.photos/id/237/2000/3000',
      thumbnail: 'https://picsum.photos/id/237/160/160',
  }]
}

3. Render the gallery with the items assembled previously

<ngx-simple-gallery [galleryItems]="galleryItems"></ngx-simple-gallery>

Parameters

Input parameters

NameRequiredTypeDefaultDescription
galleryItemsyesGalleryItem[][ ]Contains the list of images
emptyMessagenostring'Empty gallery, no images provided.'Message to show in case empty items provided
thumbnailSizenonumber160The width/height of the thumbnails in px

When all parameters set

<ngx-simple-gallery [galleryItems]="galleryItems" 
                    [thumbnailSize]="65"
                    emptyMessage="Please provide some images">  
</ngx-simple-gallery>