Skip to content
English

Usage

import { BlogPosts } from './BlogPosts.jsx'

// Without callbacks it filters and pages the posts it is given. Wire it to your posts:
<BlogPosts
  locale="en"
  topics={[{ id: 'bread', name: 'Bread' }]}
  posts={posts}                 // [{ id, topic, title, excerpt, date: '2026-11-20', minutes, likes }]
  liked={likedIds}
  postHref={(post) => '/posts/' + post.id}
  loading={!posts}
  error={postsError}
  onRetry={reloadPosts}
  onLike={(id, liked) => fetch('/api/likes', { method: 'POST', body: JSON.stringify({ id, liked }) })}
/>

Props

PropTypeDefaultWhat it does
locale'en' | 'zh-CN' | 'es' | 'ja''en'Language of the built-in text, the dates and the sample posts.
postsArray<{ id, topic, title, excerpt?, date, minutes, likes? }>sample postsThe posts, newest first; `date` is an ISO day. An empty array shows the empty state.
topicsArray<{ id, name }>sample topicsThe topics shown as filter chips, after “All”.
pageSizenumber4Posts per page.
likedstring[][]Ids of the posts this visitor already liked.
loading / errorboolean / boolean | stringfalseShows the skeleton rows, or the error banner with a retry; a string replaces its sentence.
onLike / onOpen / postHref(id, liked) => void / (post) => void / (post) => string—A like was given or taken back; a title was opened (instead of following its link); the link of a post.
onTopicChange / onPageChange / onRetry(id) => Promise | void / (page) => Promise | void / () => Promise | void—Called on a new topic or page (the list waits for a returned promise), or on retry.
labelsobject—Replaces any built-in text (keys as in copy.js).

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.

BlogPosts.jsxblog-posts.csscopy.jskit.jsxkit.cssui/base-button/ui/like-button/ui/empty-state/ui/alert-banner/ui/chip-group/ui/scroll-reveal/ui/skeleton-shimmer/ui/spinner/ui/pagination/tokens.cssREADME.md

The block, its stylesheet and text, the shared kit, the components it uses and tokens.css install together into one folder.