1.3.5 • Published 2 years ago

svelte-gallery v1.3.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Svelte Gallery

NPM License

Intelligent masonry-style photo gallery that maintains image aspect ratios in perfect rows. Svelte gallery analyses a graph of all possible row combinations to find the ideal gallery layout based on a target row height.

Originally forked from fergaldoyle/image-masonry, svelte-gallery is a full rewrite taking the core layout logic and focussing on an updated, maintained svelte implementation.

npm.io

Usage

npm i svelte-gallery
<script>
  import Gallery from 'svelte-gallery';

  const images = [
    { src: 'https://source.unsplash.com/random', width: 600, height: 400 },
    { src: 'https://source.unsplash.com/random', width: 400, height: 600 }
    { src: 'https://source.unsplash.com/random', width: 800, height: 1200 }
    { src: 'https://source.unsplash.com/random', width: 300, height: 200 }
  ];
</script>

<Gallery {images} />

Properties

PropertyDescriptionTypeDefault
imagesImages to display. Must (native) width and height valuesHTMLImageElement[][]
rowHeightIdeal row height to aim for in pxnumber220
gutterGap between images in the gallery in pxnumber8
imageComponentOptional custom image component, passed all props in images arraySvelteComponentimg
1.3.5

2 years ago

1.2.0

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago