Image Gallery
A selected image with a thumbnail grid: arrow-key navigation, aria-current and the zoom view on the selected picture.
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-galleryRequires 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.
| Prop | Type | Default |
|---|---|---|
images | readonly ImageGalleryItem[] | Required |
defaultIndex | number | 0 |
columns | 2 | 3 | 4 | 3 |
aspectRatio | number | string | - |
widths | readonly number[] | - |
transform | (src, width) => string | Identity |
sizes | string | - |
label | string | 'Image gallery' |
className | string | - |
ImageGalleryItem
One image in the set.
| Prop | Type | Default |
|---|---|---|
src | string | Required |
alt | string | Required |
thumbnailSrc | string | src |
caption | ReactNode | - |