Skip to content
English

Usage

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

// Without callbacks subscribing succeeds after a short wait. Wire it to your list:
<BlogSubscribe
  locale="en"
  readers={stats.readers}
  subscribed={me.email ?? null}
  onSubscribe={async (email) => (await fetch('/api/subscribe', { method: 'POST', body: JSON.stringify({ email }) })).ok}
  onUnsubscribe={async () => (await fetch('/api/subscribe', { method: 'DELETE' })).ok}
/>

Props

PropTypeDefaultWhat it does
locale'en' | 'zh-CN' | 'es' | 'ja''en'Language of the built-in text and the sample readers.
readers / peoplenumber / string[]1240 / sample namesHow many people already read the letter, and the names shown as initials beside the count.
subscribedstring | nullnullThe visitor’s address when they already subscribe: the block opens on the subscribed state.
onSubscribe(email) => Promise<boolean | string | void>—Subscribes an address. Resolve false, or a sentence, to keep the form and show the problem.
onUnsubscribe(email) => Promise<boolean | void>—Removes the address after the second press. Resolve false to keep the subscription.
loading / error / onRetryboolean / boolean | string / () => voidfalseShows the skeleton, or the error banner with a retry; a string replaces its sentence.
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.

BlogSubscribe.jsxblog-subscribe.csscopy.jskit.jsxkit.cssui/base-button/ui/two-step-button/ui/avatar-group/ui/alert-banner/ui/success-check/ui/text-input/ui/skeleton-shimmer/tokens.cssREADME.md

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