Skip to content

Settings

A settings layout with a grouped nav and seven ready pages: Profile, Security, Notifications, Billing, License key, API keys and Team members. Drafts with Save and Discard, confirmations for anything destructive, and the team rules that keep the last owner in place. Every action is a callback to your backend.

On this page
Used for
  • Workspace settings page
  • Account preferences
  • Agent configuration
  • Billing and team
  • Danger zone

Examples

Installation

npx knowns-ui@latest add settings-layout settings-profile settings-billing settings-api-keys settings-team settings-notifications settings-security settings-license-key
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

API keys: rotate and loading

With onRotate, each key's menu offers Rotate secret: one confirm under the row, then the new secret once, the same way a new key shows it. Every callback gets an AbortSignal as its last argument; cancelling, closing the panel or leaving the page aborts it, and a late answer is dropped. Handlers that ignore it keep working.

Layout and sections

SettingsLayout
{ title?, description?, actions?, sections, active, onActiveChange?, hrefFor?, linkAs?, children }
A sidebar nav from lg up, a scrolling tab row below (the active tab stays in view). With hrefFor the nav renders links with aria-current="page"; linkAs swaps in your router's Link.
sections
{ id, label, icon?, badge?, group? }[]
badge shows a count after the label, e.g. pending invites. Items sharing a group sit under its heading in the sidebar and after a divider in the tab row.
SettingsSection
{ title, description?, actions?, footer?, tone?, id? }
A titled panel: actions sit right of the title, footer is a muted bar (put a SaveBar there). tone="danger" tints it.
SettingsRow
{ label, description?, htmlFor?, children }
Label and help on the left, the control on the right; stacked on phones.
SaveBar
{ dirty, saving?, result?, onSave, onDiscard?, hint? }
Says "You have unsaved changes" while dirty, then "Saved." or the error. While dirty, leaving the page asks first (useUnsavedWarning).
DangerZone
{ title?, description?, children }
A danger-toned section; one SettingsRow per destructive action.

Pages

ProfileSettings
value { name, username?, email, bio?, avatarUrl? }, usernamePrefix?, description?, deleteDescription?
CallbacksonSave, onAvatarUpload?, onAvatarRemove?, onChangeEmail? or onRequestEmailChange + onConfirmEmailChange, onDeleteAccount?
Draft with Save/Discard, username rules (username and bio show only when given), avatar preview while uploading, a built-in email change (address, then the code sent to it), delete behind typing the email.
BillingSettings
plan, usage?, paymentMethod?, invoices?, changePlanHref?, changePlanLabel?, planNote?, showPaymentMethod?, badge?, price?, planBody?, planActions?, planActionsAt?, aside?, invoiceActionLabel?, invoicesEmpty?
CallbacksonChangePlan?, onManageBilling?, onUpdatePayment?, onCancel?, onResume?, onOpenInvoice?, canOpenInvoice?
Status badge and renew/cancel/trial line, usage meters that warn at 80%, an expired-card warning, invoices with status and download, cancel at period end with confirm. onManageBilling opens your provider's portal and spins until it resolves. For plans your provider does not bill (a one-time order, a grant, a bank transfer), badge, price, planBody, planActions and aside replace parts of the plan card; invoices with a description show as a table, each row with its own action label.
ApiKeysSettings
keys, scopes, defaultScopes?, expiryOptions?, environments?, idleAfterDays? (30), usageLabel?, holdMs? (1200), limit?, loading?, rotateNote?
CallbacksonCreate, onRevoke, onRename?, onRotate? (each gets an AbortSignal last)
Masked keys with scopes, last used and expiry badges. loading shows skeleton rows and holds Create. onRotate adds Rotate secret to the row menu (not for expired keys): a confirm that says what happens to the old secret (rotateNote), then the new secret once. A key's optional env (live or test) adds a badge and, with both in the list, a filter; the create form offers environments. Keys unused for idleAfterDays are marked Idle with a hint to revoke. Create unfolds inline and shows the secret once with Copy. Each row expands to created by, last used from and an optional usage sparkline. Revoke is hold to revoke (mouse, touch or Space/Enter), release cancels; reduced motion gets a confirm step.
TeamSettings
members, invites?, currentUserId, roles?, seats?
CallbacksonInvite?, onRoleChange?, onRemove?, onResendInvite?, onCancelInvite?
Invite several addresses at once, role pickers limited by your role, no self role change, the last owner is protected, leave team, seat count.
NotificationSettings
events, channels?, value { matrix, digest?, quietHours? }, title?, description?
CallbacksonSave
Grouped event x channel switches, a row "all" box and per-channel header toggles, required events stay on, digest and quiet hours, Save/Discard. One channel renders a plain list with a switch per event.
SecuritySettings
logins?, sessions?, loginsDescription?, sessionsDescription?
CallbacksonConnect?, onDisconnect?, onSignOut?, onSignOutOthers?
Connected logins with Connect/Disconnect, active sessions with this device marked, sign out one or every other session.
LicenseKeySettings
keys, usage? (with stats?), empty?, notice?, layout? ("list" | "featured"), plan?, hint?
CallbacksonReveal?, onRegenerate?, onVisibleChange?
Masked keys that can be shown again (unlike API keys), Copy, Regenerate behind a confirm, status and dates, a usage meter that resets on a new key. layout="featured" shows the first key large with Copy key as the main action, the plan beside the status and the meter in a side panel with a few stats; other keys follow as rows.

Every callback resolves to { ok: true, message? } or { ok: false, error }, and a thrown error is shown as a message instead of leaving a button spinning. The role and seat rules are UI guards only: enforce them on your server too.

What it handles

  1. 01Lays out a page title, a section nav and the content, with the nav as a sticky sidebar from lg up and a scrolling tab row below.
  2. 02Builds the nav from a sections array of id, label, icon, badge and group, and draws a heading or a divider wherever the group changes.
  3. 03Renders nav items as buttons that call onActiveChange, or as links through hrefFor and linkAs for routed settings.
  4. 04Keeps the active tab visible in the mobile row by scrolling that row sideways only, never the page.
  5. 05Provides SettingsSection, SettingsRow and DangerZone: a titled panel with a footer, a label-and-control row, and a red-bordered panel with one action per row.
  6. 06Ships SaveBar with useUnsavedWarning, which shows the unsaved-change line, enables Save only when dirty and asks the browser to confirm before a reload.

States

First render
Nothing. The nav and sections paint as they are
none
Nav item hover or focus
The item background and text colour change
120ms, ease out
Active section change
The active item takes the muted fill and aria-current, and the content swaps at once
none
Save bar, unsaved changes
The status line switches to "You have unsaved changes." and Save turns on
none, at once
Reduced motion
Colour changes land at once
0ms

Works with

When to use

When to use

  • The settings area of a SaaS app: profile, billing, API keys, team members and notifications.
  • Any form page that needs Save and Discard, unsaved-change warnings and a danger zone.

When not to use

  • A single quick toggle in context, like muting one thread: use Switch.
  • Showing usage against a plan on a dashboard: use Usage Meter.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Settings to my app and wire it to my own data.
  • I need the settings area of a SaaS app: profile, billing, API keys, team members and notifications. Set that up with the Knowns UI Settings.
  • Which Settings props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "settings-layout" }) and search_docs({ query: "settings" }).

Need help?

Stuck on Settings, or found something off? We read every message.