本文へ移動
日本語

使い方

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

// Without callbacks every action is simulated after a short wait. Wire them to your account API:
<Settings
  locale="en"
  profile={{ name, email, role, bio }}
  notifications={prefs}        // [{ id, label, description, on, locked? }]
  sessions={devices}           // [{ id, name, place, seen, current?, kind: 'laptop' | 'phone' }]
  twoFactor={user.twoFactor}
  loading={!user}
  onSave={async (draft) => (await saveAccount(draft)).ok}   // draft: { profile, notifications: { [id]: boolean } }
  onSignOut={(id) => endSession(id)}
  onTwoFactor={(on) => setTwoFactor(on)}
  onDelete={async () => (await deleteAccount()).ok}
/>

プロパティ

プロパティ型既定値説明
locale'en' | 'zh-CN' | 'es' | 'ja''en'組み込みの文言とサンプルデータの言語。
profile{ name, email, role, bio }sample member保存済みのプロフィール。編集内容と違うと保存バーが現れます。
notificationsArray<{ id, label, description, on, locked? }>sample switches通知のスイッチ。locked のものはオンのまま理由を表示します。
sessions / twoFactorArray<{ id, name, place, seen, current?, kind }> / booleansample devices / falseログイン中の端末と、2 段階認証がオンかどうか。
defaultSection'profile' | 'notifications' | 'security''profile'最初に開く項目。
loading / errorboolean / boolean | stringfalse読み込み中はスケルトン、エラー時は再試行付きの表示。文字列を渡すと説明を置き換えます。
onSave(draft) => Promise<boolean | void>—プロフィールと通知の変更を保存します。false を返すと保存失敗と再試行を表示します。
onSignOut / onTwoFactor / onDelete(id) => Promise<boolean | void> / (on) => … / () => …—端末のログアウト、2 段階認証の切り替え、アカウント削除。false を返すと画面上の変更を元に戻します。
labelsobject—組み込みの文言を置き換えます(キーは copy.js と同じ)。
classNamestring—ルートの section に追加されます。

プロジェクトに追加

プロンプトを Codex や Claude Code に貼り付けます。エージェントが公開ソースを読み、書き込むファイルを示してから、使っているコンポーネントと一緒にブロックを追加します。

Settings.jsxsettings.csscopy.jskit.jsxkit.cssui/base-button/ui/hold-to-confirm/ui/alert-banner/ui/save-status/ui/elastic-switch/ui/text-input/ui/textarea/ui/skeleton-shimmer/tokens.cssREADME.md

ブロック本体、スタイルと文言、共通の kit、使っているコンポーネント、tokens.css が 1 つのフォルダにまとめて入ります。