使い方
import { LandingPricing } from './LandingPricing.jsx'
// Without onChoose a plan starts after a short wait. Wire it to your checkout:
<LandingPricing
locale="en"
currency="USD"
plans={plans} // [{ id, name, monthly, yearly, limit, people, points, featured? }]
compare={featureRows} // [{ name, values: [true | false | string per plan] }]
unit={['brew', 'brews']} // what the finder counts; a plan's limit is in it
steps={[10, 30, 100, 300]} // where the slider stops
finder={{ lead: 'Each month I brew', label: 'Brews a month', shared: 'For a café team', people: 3 }}
billing="yearly"
loading={!plans}
error={pricesError}
onRetry={reloadPrices}
onChoose={async (planId, billing) => (await startTrial(planId, billing)).ok}
/>プロパティ
| プロパティ | 型 | 既定値 | 説明 |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | 組み込みの文言、サンプルのプランと価格の言語。 |
plans | Array<{ id, name, monthly, yearly, limit: number | null, people, points: string[], featured? }> | sample plans | 順番どおりのプラン。価格は月額。プラン選びの単位での `limit`(null は無制限。旧名 `plants`)と `people` で、どのプランに印が付くかが決まります。 |
compare | Array<{ name, values: Array<boolean | string> }> | sample rows | 比較表の行。プランごとに true、false、または短い文字列。 |
currency | string | by locale | すべての価格に使う ISO 通貨コード。 |
billing | 'monthly' | 'yearly' | 'yearly' | 最初に表示する支払い方法。 |
unit | string | [one, many] | (n) => string | plants (sample) | プラン選びが数えるもの。"杯"、["seat", "seats"]、または数を文章にする関数。プランの `limit` はこの単位です。 |
steps | number[] | 1 … 40 | スライダーが止まる値。例 [100, 500, 1000, 5000]。なければ `finder.min` から `finder.max` まで動きます。 |
finder | { title?, lead?, label?, min?, max?, step?, shared?: string | false, people? } | false | — | プラン選びの文言と範囲をひとつのオブジェクトで。`lead` は数の前の文、`label` は読み上げ用、`shared` はスイッチ(false で非表示。オンのときプランには `people` 人分が必要、既定 2)。false でプラン選びを出さず、`featured` のプランに印を付けます。 |
count / shared | number / boolean | 8 / false | プラン選びの初期値(`plants` は `count` の旧名)。 |
loading | boolean | false | 価格の読み込み中はプランのスケルトンを表示します。 |
error | boolean | string | false | 再試行ボタン付きのエラーを表示。文字列を渡すと説明を置き換えます。 |
onChoose | (planId, billing) => Promise<boolean | void> | — | プランを開始します。false を返すとボタンのまま、それ以外は開始済みになります。 |
onBillingChange / onRetry | (billing) => void / () => void | — | 支払い方法の切り替え時と、エラー表示の再試行時に呼ばれます。 |
labels | object | — | 組み込みの文言を置き換えます(キーは copy.js と同じ)。 |
className | string | — | ルートの section に追加されます。 |
プロジェクトに追加
プロンプトを Codex や Claude Code に貼り付けます。エージェントが公開ソースを読み、書き込むファイルを示してから、使っているコンポーネントと一緒にブロックを追加します。
LandingPricing.jsxlanding-pricing.csscopy.jskit.jsxkit.cssui/base-button/ui/rolling-number/ui/alert-banner/ui/success-check/ui/elastic-switch/ui/range-slider/ui/skeleton-shimmer/ui/sliding-tabs/tokens.cssREADME.md
ブロック本体、スタイルと文言、共通の kit、使っているコンポーネント、tokens.css が 1 つのフォルダにまとめて入ります。