Usage
import { PortfolioGallery } from './PortfolioGallery.jsx'
// Without onFilter the grid filters what it holds. Load from your server instead:
<PortfolioGallery
locale="en"
disciplines={[{ id: 'product', name: 'Product' }]}
projects={projects} // [{ id, title, kind, year, client, summary, art, ratio, href }]
loading={!projects}
error={loadError}
onRetry={reload}
onFilter={async (kind) => setProjects(await fetchProjects(kind))}
onOpen={(project) => router.push('/work/' + project.id)}
/>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | Language of the built-in text and sample projects. |
projects | Array<{ id, title, kind, year, client, summary, art, ratio, href }> | sample projects | The projects in order. `kind` is a discipline id; `art` picks the drawn cover and `ratio` its width / height. An empty array shows the empty state. |
disciplines | Array<{ id, name }> | sample disciplines | The filters, in order; “All” comes first by itself, and each shows its count. |
onFilter | (kind) => Promise<void> | void | — | A filter was chosen. While its promise runs the grid dims in place and is marked busy. |
onOpen | (project) => void | — | A project’s cover was pressed. With `href` on the project the cover is a link. |
loading / error / onRetry | boolean / boolean | string / () => void | false | Skeleton covers while loading; an error banner with a retry button (a string replaces its sentence). |
minColumnWidth / maxColumns | number | 200 / 4 | The narrowest column and the most columns; the count follows the block’s own width. |
renderCover | (project) => ReactNode | — | Draws a cover of your own (an image, say) instead of the drawn one. |
labels | object | — | Replaces any built-in text (keys as in copy.js). |
className | string | — | Added to the root section. |
Add it to your project
Copy the prompt into Codex or Claude Code. The agent reads the published source, shows you what it will write and adds the block together with the components it is built from.
PortfolioGallery.jsxportfolio-gallery.csscopy.jskit.jsxkit.cssui/base-button/ui/empty-state/ui/alert-banner/ui/chip-group/ui/masonry-grid/ui/skeleton-shimmer/ui/hover-card/tokens.cssREADME.md
The block, its stylesheet and text, the shared kit, the components it uses and tokens.css install together into one folder.