@molecule/app-image-gallery-svelte
Feature · image-gallery · App (browser) · v1.1.2 · Apache-2.0
Main image + thumbnail grid gallery with selection + optional upload
npm install @molecule/app-image-gallery-svelteHow it works
@molecule/app-image-gallery-svelte is a ready-made image-gallery feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
<script lang="ts">
import { ImageGallery } from '@molecule/app-image-gallery-svelte'
const images = [
'https://example.com/photo-1.jpg',
'https://example.com/photo-2.jpg',
'https://example.com/photo-3.jpg',
]
</script>
<!-- Uncontrolled — manages its own selected index. -->
<ImageGallery {images} maxThumbnails={4} />Works with: @molecule/app-svelte, @molecule/app-ui, @molecule/app-ui-svelte
Reference
Svelte image gallery — the Svelte counterpart of
@molecule/app-image-gallery-react, with the same props and the same DOM.
Exports ImageGallery — main image + thumbnail grid with controlled-optional
selection and "+N" overflow summarisation.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
<script lang="ts">
import { ImageGallery } from '@molecule/app-image-gallery-svelte'
const images = [
'https://example.com/photo-1.jpg',
'https://example.com/photo-2.jpg',
'https://example.com/photo-3.jpg',
]
</script>
<!-- Uncontrolled — manages its own selected index. -->
<ImageGallery {images} maxThumbnails={4} />
Type
feature
Installation
npm install @molecule/app-image-gallery-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
API
Interfaces
ImageGalleryProps
Props accepted by the ImageGallery component.
interface ImageGalleryProps {
/** Image URLs in display order. */
images: string[]
/** Controlled selected index — caller owns state. */
selectedIndex?: number
/** Called when a thumbnail is clicked. */
onSelect?: (index: number) => void
/** Max thumbnails shown. Extra are summarised as "+N". */
maxThumbnails?: number
/**
* Alt-text for screen readers. Applied per-image; falls back through i18n to
* `'Image {{number}}'` (`imageGallery.alt.fallback`).
*/
alts?: string[]
/** Extra classes on the outer wrapper. */
className?: string
}
Constants
ImageGallery
const ImageGallery: LegacyComponentType
Injection Notes
Requirements
Peer dependencies:
@molecule/app-svelte^3.5.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-svelte^1.1.0svelte^5.0.0
Runtime Dependencies
-
@molecule/app-svelte -
@molecule/app-ui -
@molecule/app-ui-svelte -
svelte -
Renders nothing when
imagesis empty — no empty-state UI. -
maxThumbnailsdoubles as the thumbnail grid's column count. Any value is safe: it is snapped to the nearest column count the ClassMap grid actually supports (1-6 or 12), so a realgrid-cols-*class is always emitted and extra thumbnails wrap onto additional rows instead of collapsing. -
Default alt text falls back through i18n to "Image N" (
imageGallery.alt.fallback, EnglishdefaultValue) — passaltswith per-image strings in apps that know them. -
getClassMap()requires a bonded ClassMap (e.g.@molecule/app-ui-tailwind).
Translations
Translation strings are provided by @molecule/app-locales-image-gallery.