Image Gallery

A selected image with a thumbnail grid: arrow-key navigation, aria-current and the zoom view on the selected picture.

UIimage-galleryView JSON

The selected picture keeps the zoom behaviour of `ImageZoom`; the thumbnails are one roving-focus group. Arrow keys wrap around the set, Home and End jump to the edges, and the selected thumbnail carries `aria-current` so the state is exposed to assistive technology as well as sighted users.

Preview

The opening of the sample clip.

Installation

Add the item with the shadcn CLI, or copy the source manually.

pnpm dlx shadcn@latest add litingyes/blocove/image-gallery

Requires a shadcn/ui project set up with Base UI primitives. Blocove is developed against the b0 preset, but it installs no base config or theme tokens: your own preset, fonts and colors stay in place.

Or install from the namespace after adding the registry: npx shadcn@latest add @blocove/image-gallery

API Reference

Props accepted by the exported components.

ImageGallery

A selected image with a thumbnail grid. Clicking a thumbnail selects it; the keyboard moves the selection and the focus together.

PropTypeDefault
imagesreadonly ImageGalleryItem[]Required
defaultIndexnumber0
columns2 | 3 | 43
aspectRationumber | string-
widthsreadonly number[]-
transform(src, width) => stringIdentity
sizesstring-
labelstring'Image gallery'
classNamestring-

ImageGalleryItem

One image in the set.

PropTypeDefault
srcstringRequired
altstringRequired
thumbnailSrcstringsrc
captionReactNode-