Many pictures as a grid or a scroll-snap strip: lazy tiles that keep their aspect, skeleton, hidden and broken states, single or multiple picking, and a lightbox with arrow keys and Esc.
API reference
Generated from the types. Every part also takes className.
ImageGrid
- itemsrequired
ImageGridItem[]- labelrequired
stringNames the collection for screen readers, e.g. "Images in Forklift aisles v3".- layout
"grid" | "strip" = "grid"grid: rows of tiles that fill the width. strip: one row that scrolls sideways and snaps to each tile.- aspect
"video" | "square" | "4/3" = "4/3"Every tile keeps this shape before and after its picture loads, so nothing jumps.- size
"sm" | "md" | "lg" = "md"The smallest a tile gets (grid) or its width (strip): 96, 144 or 192 px.- loading
booleanShow skeleton tiles instead of the items.- loadingCount
numberHow many skeleton tiles; default 8 (grid) or 4 (strip).- selection
"none" | "single" | "multiple" = "none"none: a tile opens the lightbox. single or multiple: a tile is picked, and a corner button opens the lightbox.- selected
string[]Picked ids (controlled).- defaultSelected
string[] = []- onSelectedChange
(ids: string[]) => void- lightbox
boolean = trueOpen pictures in a lightbox. On by default.- onReveal
(item: ImageGridItem) => voidCalled when someone asks to see a hidden picture, e.g. to log the view.- labels
Partial<ImageGridLabels>