Usage
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}
/>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | Language of the built-in text and sample data. |
profile | { name, email, role, bio } | sample member | The saved profile; edits are compared with it to show the unsaved bar. |
notifications | Array<{ id, label, description, on, locked? }> | sample switches | The notification switches; a locked one stays on and says why. |
sessions / twoFactor | Array<{ id, name, place, seen, current?, kind }> / boolean | sample devices / false | The signed-in devices and whether two-step sign-in is on. |
defaultSection | 'profile' | 'notifications' | 'security' | 'profile' | The section open at first. |
loading / error | boolean / boolean | string | false | Show the skeleton while loading, or the error banner with a retry; a string replaces its sentence. |
onSave | (draft) => Promise<boolean | void> | — | Saves the profile and notification draft. Resolve false to show the failed save with Retry. |
onSignOut / onTwoFactor / onDelete | (id) => Promise<boolean | void> / (on) => … / () => … | — | Sign a device out, switch two-step sign-in, delete the account. Resolve false to undo the change on screen. |
labels | object | — | Replaces any built-in text (keys as in copy.js). |
className | string | — | 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.
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
The block, its stylesheet and text, the shared kit, the components it uses and tokens.css install together into one folder.