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
- 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-keyPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Settings layout, Profile settings, Billing settings, API keys settings, Team settings, Notification settings, Settings: security, Settings: license key from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/settings-layout
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add settings-layout settings-profile settings-billing settings-api-keys settings-team settings-notifications settings-security settings-license-key
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/hold-button/hold-button.tsx
- components/ui/knowns/hold-button/hold-button-utils.ts
- components/ui/knowns/blocks/settings/settings-layout.tsx
- components/ui/knowns/blocks/settings/settings-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/tooltip.tsx
- components/ui/knowns/tooltip-utils.ts
- components/ui/knowns/avatar.tsx
- components/ui/knowns/dialog.tsx
- components/ui/knowns/kbd.tsx
- components/ui/knowns/field-class.ts
- components/ui/knowns/textarea.tsx
- components/ui/knowns/chat-composer/use-autosize.ts
- components/ui/knowns/input.tsx
- components/ui/knowns/otp-input.tsx
- components/ui/knowns/blocks/settings/settings-profile.tsx
- components/ui/knowns/badge.tsx
- components/ui/knowns/progress.tsx
- components/ui/knowns/blocks/settings/settings-billing.tsx
- components/ui/knowns/checkbox.tsx
- components/ui/knowns/menu.tsx
- components/ui/knowns/segmented-control.tsx
- components/ui/knowns/select.tsx
- components/ui/knowns/skeleton.tsx
- components/ui/knowns/blocks/settings/settings-api-keys.tsx
- components/ui/knowns/blocks/settings/settings-team.tsx
- components/ui/knowns/switch.tsx
- components/ui/knowns/blocks/settings/settings-notifications.tsx
- components/ui/knowns/blocks/settings/settings-security.tsx
- components/ui/knowns/blocks/settings/settings-license-key.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/settings-layout, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "settings-layout" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.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.
License key: featured
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.
| Prop | Type | Default | Description |
|---|---|---|---|
| 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?- Callbacks
onSave, 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?- Callbacks
onChangePlan?, 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?- Callbacks
onCreate, 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?- Callbacks
onInvite?, 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?- Callbacks
onSave - 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?- Callbacks
onConnect?, 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?- Callbacks
onReveal?, 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.
| Block | Main props | Callbacks | What it handles |
|---|---|---|---|
| ProfileSettings | value { name, username?, email, bio?, avatarUrl? }, usernamePrefix?, description?, deleteDescription? | onSave, 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? | onChangePlan?, 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? | onCreate, 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? | onInvite?, 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? | onSave | 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? | onConnect?, 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? | onReveal?, 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
- 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.
- 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.
- 03Renders nav items as buttons that call onActiveChange, or as links through hrefFor and linkAs for routed settings.
- 04Keeps the active tab visible in the mobile row by scrolling that row sideways only, never the page.
- 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.
- 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
| State | What moves | Timing |
|---|---|---|
| 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" }).