Skip to content
English

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

PropTypeDefaultWhat it does
locale'en' | 'zh-CN' | 'es' | 'ja''en'Language of the built-in text and sample projects.
projectsArray<{ id, title, kind, year, client, summary, art, ratio, href }>sample projectsThe 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.
disciplinesArray<{ id, name }>sample disciplinesThe 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 / onRetryboolean / boolean | string / () => voidfalseSkeleton covers while loading; an error banner with a retry button (a string replaces its sentence).
minColumnWidth / maxColumnsnumber200 / 4The 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.
labelsobject—Replaces any built-in text (keys as in copy.js).
classNamestring—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.