A simple gallery lib for Angular [18]. It displays all the images as thumbnails and makes it big, when clicked/tapped on it.
- mobile friendly
- lightweight
- use images from any source
- the gallery takes up as much space as you let it
- navigate forwards/backwards with keyboard arrows or touch/click on arrows in the showcase dialog
- loading spinner while loading
- you can define a thumbnail or leave it empty. It is recommended to provide it though, because of performance reasons.
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';
Gallery | Angular | Readme |
---|---|---|
<=1.x.x |
>=18 |
here |
import { NgxSimpleGalleryComponent } from '@zolcsi/ngx-simple-gallery';
@Component({
standalone: true,
imports: [NgxSimpleGalleryComponent],
})
export class AppComponent {}
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',
}]
}
<ngx-simple-gallery [galleryItems]="galleryItems"></ngx-simple-gallery>
Name | Required | Type | Default | Description |
---|---|---|---|---|
galleryItems | yes | GalleryItem[] | [ ] | Contains the list of images |
emptyMessage | no | string | 'Empty gallery, no images provided.' | Message to show in case empty items provided |
thumbnailSize | no | number | 160 | The width/height of the thumbnails in px |
<ngx-simple-gallery [galleryItems]="galleryItems"
[thumbnailSize]="65"
emptyMessage="Please provide some images">
</ngx-simple-gallery>