@molecule/app-image-gallery-solid

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-solid

npm · Source on GitHub

How it works

@molecule/app-image-gallery-solid 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.

import { ImageGallery } from '@molecule/app-image-gallery-solid'

const images = [
  'https://example.com/photo-1.jpg',
  'https://example.com/photo-2.jpg',
  'https://example.com/photo-3.jpg',
]

export function Gallery() {
  // Uncontrolled — manages its own selected index.
  return <ImageGallery images={images} maxThumbnails={4} />
}

Works with: @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid

Reference

Solid image gallery.

Exports ImageGallery — the Solid counterpart of @molecule/app-image-gallery-react with the same props and the same DOM: 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.ts JSDoc, not this file.

Quick Start

import { ImageGallery } from '@molecule/app-image-gallery-solid'

const images = [
  'https://example.com/photo-1.jpg',
  'https://example.com/photo-2.jpg',
  'https://example.com/photo-3.jpg',
]

export function Gallery() {
  // Uncontrolled — manages its own selected index.
  return <ImageGallery images={images} maxThumbnails={4} />
}

Type

feature

Installation

npm install @molecule/app-image-gallery-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js

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
}

Functions

ImageGallery(props)

Main image + thumbnail grid gallery. Controlled-optional: when selectedIndex is omitted the component tracks its own selection.

Used for product images, property listings, portfolio galleries.

This is the Solid counterpart of @molecule/app-image-gallery-react: the same props (React names), the same ClassMap tokens, and the same DOM for the same input.

function ImageGallery(props: ImageGalleryProps): JSX.Element
  • props — Component props (see ImageGalleryProps).

Returns: The rendered image gallery.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-solid ^3.5.0 || ^4.0.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-solid ^1.1.0
  • solid-js ^1.8.0

Runtime Dependencies

  • @molecule/app-solid

  • @molecule/app-ui

  • @molecule/app-ui-solid

  • solid-js

  • Renders nothing when images is empty — no empty-state UI.

  • maxThumbnails doubles 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 real grid-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, English defaultValue) — pass alts with 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.