Xzero UI
Pro library

Settings commandPro

Workspace settings where a search field grows into a palette that flies you to any setting.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/settings-command
Live · keyboard ready

Use this for app or workspace settings with many options. Describe your settings in the data file, load saved values from your API, and persist the changed ids through onSave; saving in the preview is simulated.

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/settings-command

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { SettingsCommand } from "@/components/xzero/blocks/settings-command/settings-command";
import { settingDefinitions, settingsSections } from "@/components/xzero/blocks/settings-command/settings-command-data";

export function WorkspaceSettings({ saved }: { saved: Record<string, string | boolean> }) {
  return (
    <SettingsCommand
      sections={settingsSections}
      settings={settingDefinitions}
      defaultValues={saved}
      onSave={async (values, changed) => {
        await fetch("/api/workspace/settings", { method: "PATCH", body: JSON.stringify(Object.fromEntries(changed.map(id => [id, values[id]]))) });
      }}
    />
  );
}

API reference

SettingsCommand

Workspace settings on one scrolling page with a sticky section nav, a search field that grows into a command palette, and an unsaved changes bar. Picking a result flies the palette into the matching row, scrolls it into view, and the row breathes twice.

PropTypeDefaultDescription
sectionsSettingsSection[]settingsSectionsSections in page order: id, label, and a one line description.
settingsSettingDefinition[]settingDefinitionsEvery setting: id, section, label, description, kind (switch, segmented, select, text), options, keywords for search, placeholder, and prefix.
defaultValuesRecord<string, string | boolean>savedSettingsSaved values keyed by setting id. Edits are compared against these to count unsaved changes.
suggestedstring[]suggestedSettingIdsSetting ids listed in the palette before anything is typed.
onSave(values, changedIds) => Promise<void> | void–Persists the draft. Resolve to confirm; reject to keep the bar open with Retry. Without it the save is simulated.
onValuesChange(values) => void–Called on every edit with the full draft.
titlestring"Settings"Heading beside the search field.
classNamestring–Class on the root.

Keyboard interactions

KeysAction
Command K / Control K / slashOpens the settings search while focus is inside the block.
Arrow up / Arrow downMoves through results. The input keeps focus; the active result is announced through aria-activedescendant.
EnterJumps to the active result and moves focus to its control.
EscapeCloses the palette back into the search field and returns focus to it.
TabMoves through section nav, controls, and the Save and Discard buttons.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Guidance for AI tools

Blocks are complete, self-contained screens with sample data. Replace the sample data and connect the callbacks described above. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components