# Command menu

Search actions and navigate with the keyboard.

Access: pro. Category: Navigation. Kind: composite.

## When to use

- Use it when a page needs search actions and navigate with the keyboard.
- Choose it as the nav region when composing a page from independently reusable TidalUI sections.

## Alternatives

- Choose navigation-bar instead when responsive saas navigation with native links, actions and an in-flow mobile disclosure is the actual interface need, rather than command menu.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Command menu

```sh
npx shadcn@latest add @tidal-pro/command-menu
```

Stylesheets: `components/ui/tidal.css`, `components/ui/command-menu.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/command-menu.css";
import{TidalCommandMenu}from"./components/ui/command-menu";
export default()=><div className="tidal-scope"><TidalCommandMenu actions={[{id:"example",label:"Demo",onSelect:() => {}}]}/></div>;
```

## Structured props

- `TidalCommandMenu.actions: Array<CommandAction>`: Required actions value accepted by this exported component.
- `TidalCommandMenu.className?: string | undefined` (default ""): Optional class name value accepted by this exported component.
- `TidalCommandMenu.label?: string | undefined` (default "Command menu"): Optional label value accepted by this exported component.
- `TidalCommandMenu.onAction?: ((id: string) => void) | undefined`: Callback invoked when the action interaction is proposed.
- `TidalCommandMenu.placeholder?: string | undefined` (default "Search actions"): Optional placeholder value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/command-menu.tsx) | [Manifest](https://tidalui.com/examples/command-menu.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useState } from "react";

import { LayoutDashboard, FolderPlus, Users, Settings } from "lucide-react";

import { TidalCommandMenu } from "./components/ui/command-menu";

import "./components/ui/command-menu.css";

import "./components/ui/keyboard-key.css";



const tidalExampleStyles = ".command-specimen{width:100%;max-width:420px}.command-demo-status{font-size:11px;text-align:center;color:var(--t-muted);margin:13px 0 0}";

export function CommandDemo() {
  const [chosen, setChosen] = useState("");
  return (
    <div className="command-specimen">
      <TidalCommandMenu
        actions={[
          {
            id: "dashboard",
            label: "Go to dashboard",
            group: "Navigate",
            icon: LayoutDashboard,
            shortcut: "G D",
            onSelect: () => setChosen("Sample dashboard selected."),
          },
          {
            id: "projects",
            label: "Create a project",
            group: "Actions",
            icon: FolderPlus,
            shortcut: "N P",
            onSelect: () => setChosen("Create project action selected."),
          },
          {
            id: "team",
            label: "Invite a teammate",
            group: "Actions",
            icon: Users,
            onSelect: () => setChosen("Invite action selected."),
          },
          {
            id: "settings",
            label: "Open settings",
            group: "Navigate",
            icon: Settings,
            shortcut: "G S",
            onSelect: () => setChosen("Settings action selected."),
          },
        ]}
      />
      <p className="command-demo-status" role="status">
        {chosen || "Choose an action."}
      </p>
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <CommandDemo />
    </div>
  );
}

```

## Gotchas

- Install the declared registry dependencies and render inside a tidal-scope with the foundation stylesheet loaded.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation.","Escape dismisses the open overlay where the underlying primitive supports dismissal."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

actions: unique id, label, group?, keywords?, icon?, shortcut?, disabled?, onSelect. Optional label, placeholder, className, onAction. Inline cmdk menu with ArrowUp/Down, Enter and looping focus. Shortcut labels are hints, not registered handlers. Wrap in a dialog for global use.
