0.0.4 • Published 10 months ago

svelte-photoswipe-gallery v0.0.4

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

Svelete PhotoSwipe Gallery

The easiest way to us a Photoswipe Lightbox with a Masonry Gallery in Svelte.

How to use it

<script>
	import PhotoswipeGallery from 'svelte-photoswipe-gallery';

	const images = [
		{
			src: 'https://source.unsplash.com/random',
			preview: 'https://source.unsplash.com/random',
			width: 400,
			height: 600,
			description: 'Lorem ipsum dolor sit amet',
			alt: 'Random'
		},
		{
			src: 'https://source.unsplash.com/random',
			width: 800,
			height: 1200,
			description: 'Lorem ipsum dolor sit amet',
			alt: 'Random'
		},
		{
			src: 'https://source.unsplash.com/random',
			width: 300,
			height: 200,
			description: 'Lorem ipsum dolor sit amet',
			alt: 'Random'
		},
		{
			src: 'https://source.unsplash.com/random',
			width: 600,
			height: 400,
			description: 'Lorem ipsum dolor sit amet',
			alt: 'Random'
		}
	];
</script>

<PhotoswipeGallery
	{images}
	showDescription="{false}"
	showDownloadButton="{false}"
	showFullscreenButton="{false}"
/>

Options

NameTypeDefaultDescription
imagesArray[]Array of image objects with at least src, width and height
showDescriptionBooleantrueShows the description of the image at the bottom of the opened Lightbox
showDownloadButtonBooleantrueShows the download button in the opened Lightbox
showFullscreenButtonBooleantrueShows the fullscreen button in the opened Lightbox

Image Object

NameTypeRequiredDescription
srcStringyesThe source of the image.
previewStringnoThe source of the preview image, if given, that's the image shown in the Masonry Gallery.
widthNumberyesThe width of the image in the opened Lightbox.
heightNumberyesThe height of the image in the opened Lightbox.
descriptionStringnoThe description of the image, used for the description in the opened Lightbox (if showDescription = true).
altStringno (but recommended)The alt text of the image, used for the description text of the image in the opened Lightbox, if no description is available. Also used if the Picture can't get loaded or for Screenreaders.

Demo

See also the Demo on CodeSandbox.

0.0.4

10 months ago

0.0.3

1 year ago

0.0.2

2 years ago

0.0.1

2 years ago