Gallery

A collection book for anything: items, characters, fish, recipes. Locked entries are silhouettes, a progress bar counts what is found, and opening an entry shows a big view with previous and next.

View as Markdown

Group tabs, search over found entries and a found/total bar. Arrow keys move between cards; in the big view, Prev and Next skip locked entries.

Installation

npx shadcn@latest add @cozy/gallery

Usage

import { Gallery } from "@/components/ui/gallery"

<Gallery entries={[{ id: "carp", name: "River carp", image: <Fish />, rarity: "rare" }]} />

Examples

Generic over your data: renderDetail shows a CharacterInfo for each villager.

API

Everything else is passed through to the underlying element or Radix primitive.

PropTypeDefaultDescription
entriesGalleryEntry<T>[]–{ id, name, label?, image?, rarity?, group?, unlocked?, caption?, description?, badge?, data? }.
groups / search{ id, label }[] / boolean | string–Filter tabs and a search box (matches found entries).
showProgress / progressLabelboolean / ReactNodetrue / "Found"The found/total bar.
cardSizenumber132Minimum card width in px; cards grow to fill the row.
cardHeight / artScalenumberrow height / 0.74Fixed card height in px (by default every card in a row matches the tallest), and art size as a share of the card width.
lockedName / openLockedReactNode / boolean"???" / falseName for locked entries, and whether they open.
openId / onOpenChangestring | null–Control which entry is open.
renderCard / renderDetail / detailActions(entry) => ReactNode–Your own card inside, big-view body and buttons.