# Settings command

> Searchable workspace settings directory jumping to controls across General, Appearance, Notifications, Security, Members and Billing.

- Kind: block · Category: Settings · Interactivity: script
- Install: `npx shadcn@latest add @haze/settings-command`
- File: `src/components/haze/blocks/settings-command.astro`
- npm dependencies: @lucide/astro
- Registry dependencies: @haze/kbd, @haze/utils
- Docs page: https://hazeui.com/blocks/settings-command

## Use when
- Letting admins search and jump directly to a deeply nested setting by keyword
- Presenting a compact overview of six workspace settings domains in one card

## Avoid when
- Editing form fields directly inside a left-rail account page; use settings-page

## Alternatives
- [settings-page](https://hazeui.com/blocks/settings-page.md)
- [command-palette](https://hazeui.com/blocks/command-palette.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| id | `string` | "haze-settings-command" | no | Unique prefix for search label and heading IDs. |
| entries | `SettingEntry[]` | 6 workspace settings | no | Searchable settings cards across 6 workspace sections. |
| class | `string` |  | no | Extra classes on the outer section. |

## Accessibility
- The search input filters cards in place and reveals a clear empty message when zero settings match.
- Selecting any card announces the target section in a polite role="status" message.
- Key Tab: Move between the quick-jump search input and matching settings cards
- Key Enter / Space: Jump to the focused settings panel

## Agent prompts

### Install and use

Install the Haze UI block "Settings command" with `npx shadcn@latest add @haze/settings-command`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import SettingsCommand from "@/components/haze/blocks/settings-command.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/blocks/settings-command.md

### Customize with real content

Adapt the Haze settings-command block for our product. Replace the demo values of these props with our real content: id, entries, class. Keep the layout, the heading level rules and these accessibility details: The search input filters cards in place and reveals a clear empty message when zero settings match. Selecting any card announces the target section in a polite role="status" message. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using settings-command, check it fits: use it when letting admins search and jump directly to a deeply nested setting by keyword; presenting a compact overview of six workspace settings domains in one card. Avoid it when editing form fields directly inside a left-rail account page; use settings-page. Alternatives: @haze/settings-page, @haze/command-palette.

## Example requests that should lead here
- Create a searchable workspace settings command block across General, Appearance, Notifications, Security, Members and Billing

## Source

```astro
---
import { ArrowRight, Search, SlidersHorizontal } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";
import Kbd from "../ui/kbd.astro";

interface SettingEntry {
  id: string;
  section: "General" | "Appearance" | "Notifications" | "Security" | "Members" | "Billing";
  title: string;
  description: string;
}

interface Props {
  id?: string;
  entries?: SettingEntry[];
  class?: string;
}

const {
  id = "haze-settings-command",
  entries = [
    { id: "sc1", section: "General", title: "Workspace name & URL", description: "Change your workspace display name and custom subdomain." },
    { id: "sc2", section: "Appearance", title: "Dark tokens & reduced motion", description: "Configure surface contrast and animation preferences." },
    { id: "sc3", section: "Notifications", title: "Slack & email digest cadence", description: "Choose when team mentions and weekly summaries send." },
    { id: "sc4", section: "Security", title: "SAML SSO & two-factor enforcement", description: "Require authenticator 2FA for all workspace members." },
    { id: "sc5", section: "Members", title: "Seats, roles & pending invites", description: "Manage Admin, Editor and Viewer permissions." },
    { id: "sc6", section: "Billing", title: "Invoices & spend alerts", description: "Download VAT receipts and set monthly budget thresholds." },
  ],
  class: className,
} = Astro.props;
---

<section aria-labelledby={`${id}-title`} data-haze-settings-cmd class={cn("bg-background px-4 py-10 sm:px-6 sm:py-14", className)}>
  <div class="mx-auto max-w-3xl rounded-2xl border border-border bg-card p-5 sm:p-6">
    <div class="flex flex-wrap items-center justify-between gap-2">
      <div class="flex items-center gap-2">
        <SlidersHorizontal class="size-4 text-muted-foreground" aria-hidden="true" />
        <h2 id={`${id}-title`} class="text-base/6 font-semibold tracking-tight text-foreground">Workspace settings</h2>
      </div>
      <Kbd size="sm">/</Kbd>
    </div>

    <div class="relative mt-4">
      <Search class="pointer-events-none absolute top-1/2 left-3.5 size-4 -translate-y-1/2 text-muted-foreground" aria-hidden="true" />
      <label for={`${id}-q`} class="sr-only">Jump to a setting</label>
      <input
        id={`${id}-q`}
        data-sc-input
        type="search"
        placeholder="Jump to any setting (e.g. SSO, invoices, Slack, dark)…"
        class="h-10 w-full rounded-xl border border-frame-input bg-field pr-3.5 pl-10 text-sm text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/24 focus-visible:outline-hidden transition-[color,background-color,border-color,box-shadow] duration-150 hover:border-frame-foreground"
      />
    </div>

    <ul role="list" class="mt-4 grid gap-2 sm:grid-cols-2">
      {
        entries.map((entry) => (
          <li data-sc-item data-search={`${entry.section} ${entry.title} ${entry.description}`.toLowerCase()}>
            <button
              type="button"
              data-sc-jump={`${entry.section} → ${entry.title}`}
              class="group flex h-full w-full cursor-pointer flex-col justify-between rounded-xl border border-border bg-muted/40 p-3.5 text-left transition-colors duration-150 hover:border-border-strong hover:bg-accent focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring active:scale-[0.97] active:duration-75"
            >
              <div>
                <div class="flex items-center justify-between gap-2">
                  <span class="rounded-md border border-border bg-card px-2 py-0.5 text-[0.6875rem] font-medium text-muted-foreground">{entry.section}</span>
                  <ArrowRight class="size-3.5 text-muted-foreground transition-transform duration-150 ease-snappy group-hover:translate-x-0.5 group-hover:text-foreground" aria-hidden="true" />
                </div>
                <h3 class="mt-2 text-sm/5 font-semibold text-foreground">{entry.title}</h3>
                <p class="mt-1 text-xs/5 text-muted-foreground">{entry.description}</p>
              </div>
            </button>
          </li>
        ))
      }
    </ul>

    <p data-sc-empty hidden class="mt-4 py-6 text-center text-xs text-muted-foreground">No matching workspace settings.</p>
    <p data-sc-status role="status" class="mt-3 min-h-4 text-xs/4 text-muted-foreground"></p>
  </div>
</section>

<script>
  function initSettingsCommands() {
    document.querySelectorAll<HTMLElement>("[data-haze-settings-cmd]").forEach((root) => {
      if (root.hasAttribute("data-enhanced")) return;
      root.setAttribute("data-enhanced", "");
      const input = root.querySelector<HTMLInputElement>("[data-sc-input]");
      const empty = root.querySelector<HTMLElement>("[data-sc-empty]");
      const status = root.querySelector<HTMLElement>("[data-sc-status]");

      input?.addEventListener("input", () => {
        const q = input.value.trim().toLowerCase();
        let shown = 0;
        root.querySelectorAll<HTMLElement>("[data-sc-item]").forEach((item) => {
          const ok = !q || (item.dataset.search ?? "").includes(q);
          item.hidden = !ok;
          if (ok) shown++;
        });
        if (empty) empty.hidden = shown > 0;
      });

      root.querySelectorAll<HTMLButtonElement>("[data-sc-jump]").forEach((btn) => {
        btn.addEventListener("click", () => {
          if (status) status.textContent = `Jumped to ${btn.dataset.scJump}.`;
        });
      });
    });
  }
  initSettingsCommands();
  document.addEventListener("astro:page-load", initSettingsCommands);
</script>
```
