# Menubar

A keyboard-navigable application menubar with native actions and links, selection items, and themed portalled menus.

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

## When to use

- Use it when a page needs a keyboard-navigable application menubar with native actions and links, selection items, and themed portalled menus.
- 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 menubar.

## 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 Menubar

```sh
npx shadcn@latest add @tidal-pro/menubar
```

Stylesheets: `components/ui/tidal.css`, `components/ui/menubar.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/menubar.css";
import{TidalMenubar}from"./components/ui/menubar";
export default()=><div className="tidal-scope"><TidalMenubar/></div>;
```

## Structured props

- `TidalMenubar.theme?: MenubarTheme | undefined` (default "light"): Optional theme value accepted by this exported component.
- `TidalMenubarContent.portalContainer?: HTMLElement | null | undefined`: Optional portal container value accepted by this exported component.
- `TidalMenubarItem.destructive?: boolean | undefined`: Optional destructive value accepted by this exported component.
- `TidalMenubarLinkItem.anchorProps: Omit<Omit<DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">, "children"> & { href: string; }`: Required anchor props value accepted by this exported component.
- `TidalMenubarLinkItem.children: ReactNode`: Required children value accepted by this exported component.
- `TidalMenubarLinkItem.destructive?: boolean | undefined`: Optional destructive value accepted by this exported component.
- `TidalMenubarLinkItem.onClick?: undefined`: Callback invoked when the click interaction is proposed.

## Complete usage example

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

```tsx
"use client";

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

import { useId, useState } from "react";

import { TidalMenubar, TidalMenubarCheckboxItem, TidalMenubarContent, TidalMenubarItem, TidalMenubarLabel, TidalMenubarLinkItem, TidalMenubarMenu, TidalMenubarRadioGroup, TidalMenubarRadioItem, TidalMenubarSeparator, TidalMenubarTrigger } from "./components/ui/menubar";

import "./components/ui/menubar.css";



const tidalExampleStyles = ".tidal-scope .menubar-demo,\n.tidal-scope .menubar-demo * {\n  box-sizing: border-box;\n}\n\n.tidal-scope .menubar-demo {\n  container: tidal-menubar-demo / inline-size;\n  display: grid;\n  width: min(100%, 980px);\n  min-width: 0;\n  gap: 22px;\n  margin-inline: auto;\n  padding: clamp(16px, 4vw, 42px);\n  color: var(--t-ink);\n}\n\n.tidal-scope .menubar-demo-heading {\n  display: grid;\n  min-width: 0;\n  gap: 8px;\n}\n\n.tidal-scope .menubar-demo-heading :is(h2, p),\n.tidal-scope .menubar-demo-footer :is(p, span) {\n  margin: 0;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .menubar-demo-heading h2 {\n  font-size: clamp(27px, 5vw, 42px);\n  font-weight: 570;\n  letter-spacing: -0.05em;\n  line-height: 1;\n}\n\n.tidal-scope .menubar-demo-heading p,\n.tidal-scope .menubar-demo-footer {\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.5;\n}\n\n.tidal-scope .menubar-demo-app {\n  min-width: 0;\n  border: 1px solid var(--t-border);\n  border-radius: 18px;\n  overflow: hidden;\n  background: var(--t-surface);\n}\n\n.tidal-scope .menubar-demo-rail {\n  width: 100%;\n  min-width: 0;\n  padding: 8px;\n  overflow-x: auto;\n  scrollbar-width: thin;\n}\n\n.tidal-scope .menubar-demo-document {\n  display: grid;\n  min-width: 0;\n  gap: 20px;\n  padding: clamp(20px, 5vw, 42px);\n  border-top: 1px solid var(--t-border);\n  background: var(--t-subtle);\n}\n\n.tidal-scope .menubar-demo-document header {\n  display: grid;\n  min-width: 0;\n  gap: 6px;\n}\n\n.tidal-scope .menubar-demo-document :is(span, h3, strong, p, dl, dt, dd) {\n  margin: 0;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .menubar-demo-document header span {\n  color: var(--t-muted);\n  font-size: 11px;\n  font-weight: 700;\n  letter-spacing: 0.1em;\n  text-transform: uppercase;\n}\n\n.tidal-scope .menubar-demo-document h3 {\n  font-size: clamp(22px, 4vw, 34px);\n  font-weight: 580;\n  letter-spacing: -0.04em;\n}\n\n.tidal-scope .menubar-demo-lines {\n  display: grid;\n  min-width: 0;\n  gap: 10px;\n}\n\n.tidal-scope .menubar-demo-lines section {\n  display: grid;\n  min-width: 0;\n  gap: 5px;\n  padding: 14px;\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n  background: var(--t-surface);\n}\n\n.tidal-scope\n  .menubar-demo-document[data-density=\"compact\"]\n  .menubar-demo-lines\n  section {\n  gap: 2px;\n  padding: 9px 12px;\n}\n\n.tidal-scope .menubar-demo-lines strong {\n  font-size: 12px;\n}\n\n.tidal-scope .menubar-demo-lines p,\n.tidal-scope .menubar-demo-document dd {\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.5;\n}\n\n.tidal-scope .menubar-demo-document dl {\n  display: grid;\n  grid-template-columns: repeat(2, minmax(0, 1fr));\n  gap: 8px;\n}\n\n.tidal-scope .menubar-demo-document dl > div {\n  display: grid;\n  min-width: 0;\n  gap: 3px;\n  padding-top: 9px;\n  border-top: 1px solid var(--t-border);\n}\n\n.tidal-scope .menubar-demo-document dt {\n  font-size: 11px;\n  font-weight: 650;\n}\n\n.tidal-scope .menubar-demo-footer {\n  display: grid;\n  min-width: 0;\n  gap: 4px;\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .tidal-scope .menubar-demo-document,\n  .tidal-scope .menubar-demo-lines section {\n    transition: none;\n  }\n}";

type Density = "comfortable" | "compact";

export function MenubarDemo({ theme = "light" }: { theme?: "light" | "dark" }) {
  const demoId = useId().replace(/:/g, "");
  const headingId = `${demoId}-draft-editor`;
  const documentId = `${demoId}-document-details`;
  const [openMenu, setOpenMenu] = useState("");
  const [sectionCount, setSectionCount] = useState(3);
  const [showDetails, setShowDetails] = useState(true);
  const [density, setDensity] = useState<Density>("comfortable");
  const [status, setStatus] = useState("The local draft is ready.");

  function resetDraft() {
    setSectionCount(1);
    setShowDetails(true);
    setDensity("comfortable");
    setStatus("A new local draft replaced the sample.");
  }

  return (
    <section className="menubar-demo" aria-labelledby={headingId}>
      <header className="menubar-demo-heading">
        <h2 id={headingId}>Draft editor</h2>
        <p>Use the menus to change this local document view.</p>
      </header>

      <div className="menubar-demo-app">
        <div className="menubar-demo-rail">
          <TidalMenubar
            aria-label="Document commands"
            value={openMenu}
            onValueChange={setOpenMenu}
            theme={theme}
          >
            <TidalMenubarMenu value="file">
              <TidalMenubarTrigger>File</TidalMenubarTrigger>
              <TidalMenubarContent aria-label="File menu">
                <TidalMenubarLabel>Draft</TidalMenubarLabel>
                <TidalMenubarItem textValue="New draft" onSelect={resetDraft}>
                  <span className="tidal-menubar-item-copy">New draft</span>
                </TidalMenubarItem>
                <TidalMenubarItem
                  textValue="Review section count"
                  onSelect={() =>
                    setStatus(
                      `This local draft has ${sectionCount} ${
                        sectionCount === 1 ? "section" : "sections"
                      }.`,
                    )
                  }
                >
                  <span className="tidal-menubar-item-copy">
                    Review section count
                  </span>
                </TidalMenubarItem>
                <TidalMenubarLinkItem
                  textValue="Jump to document"
                  anchorProps={{ href: `#${documentId}` }}
                >
                  <span className="tidal-menubar-item-copy">
                    Jump to document
                  </span>
                </TidalMenubarLinkItem>
              </TidalMenubarContent>
            </TidalMenubarMenu>

            <TidalMenubarMenu value="edit">
              <TidalMenubarTrigger>Edit</TidalMenubarTrigger>
              <TidalMenubarContent aria-label="Edit menu">
                <TidalMenubarItem
                  textValue="Duplicate section"
                  onSelect={() => {
                    setSectionCount((count) => count + 1);
                    setStatus("A section was duplicated in the local draft.");
                  }}
                >
                  <span className="tidal-menubar-item-copy">
                    Duplicate section
                  </span>
                </TidalMenubarItem>
                <TidalMenubarItem
                  textValue="Undo duplicate"
                  disabled={sectionCount <= 1}
                  onSelect={() => {
                    setSectionCount((count) => Math.max(1, count - 1));
                    setStatus("The latest local section was removed.");
                  }}
                >
                  <span className="tidal-menubar-item-copy">
                    Undo duplicate
                  </span>
                </TidalMenubarItem>
                <TidalMenubarSeparator />
                <TidalMenubarItem disabled textValue="Paste from system">
                  <span className="tidal-menubar-item-copy">
                    Paste from system
                  </span>
                </TidalMenubarItem>
              </TidalMenubarContent>
            </TidalMenubarMenu>

            <TidalMenubarMenu value="view">
              <TidalMenubarTrigger>View</TidalMenubarTrigger>
              <TidalMenubarContent aria-label="View menu">
                <TidalMenubarCheckboxItem
                  checked={showDetails}
                  onCheckedChange={(checked) => {
                    setShowDetails(checked === true);
                    setStatus(
                      checked === true
                        ? "Document details are visible."
                        : "Document details are hidden.",
                    );
                  }}
                >
                  Show details
                </TidalMenubarCheckboxItem>
                <TidalMenubarSeparator />
                <TidalMenubarLabel>Density</TidalMenubarLabel>
                <TidalMenubarRadioGroup
                  value={density}
                  onValueChange={(nextDensity) => {
                    if (
                      nextDensity === "comfortable" ||
                      nextDensity === "compact"
                    ) {
                      setDensity(nextDensity);
                      setStatus(`${nextDensity} density is active.`);
                    }
                  }}
                >
                  <TidalMenubarRadioItem value="comfortable">
                    Comfortable
                  </TidalMenubarRadioItem>
                  <TidalMenubarRadioItem value="compact">
                    Compact
                  </TidalMenubarRadioItem>
                </TidalMenubarRadioGroup>
              </TidalMenubarContent>
            </TidalMenubarMenu>
          </TidalMenubar>
        </div>

        <article
          className="menubar-demo-document"
          id={documentId}
          data-density={density}
        >
          <header>
            <span>Local draft</span>
            <h3>Project handoff</h3>
          </header>
          <div
            className="menubar-demo-lines"
            aria-label={`${sectionCount} sections`}
          >
            {Array.from({ length: sectionCount }, (_, index) => (
              <section key={index}>
                <strong>Section {index + 1}</strong>
                <p>Review notes and next steps for the project team.</p>
              </section>
            ))}
          </div>
          {showDetails ? (
            <dl>
              <div>
                <dt>Sections</dt>
                <dd>{sectionCount}</dd>
              </div>
              <div>
                <dt>Density</dt>
                <dd>{density}</dd>
              </div>
            </dl>
          ) : null}
        </article>
      </div>

      <footer className="menubar-demo-footer">
        <p role="status" aria-live="polite">
          {status}
        </p>
        <span>Sample changes stay on this page.</span>
      </footer>
    </section>
  );
}

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

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## 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."}

TidalMenubar forwards controlled value/onValueChange or defaultValue state, direction, looping, native div attributes and ref while carrying an explicit light/dark theme into portalled content. Menu values identify which top-level menu is open. TidalMenubarTrigger always renders a 44px native type=button and forwards compatible button attributes/ref; disabled or aria-disabled true resolve native disabled behavior while false is preserved. TidalMenubarContent forwards menu content attributes/ref, looping, collision, Escape/outside/autofocus events and a consumer-owned portalContainer. Radix supplies application-menubar arrow navigation, trigger switching, menu item focus, typeahead, dismissal and focus return. Action, checkbox and radio items forward primitive attributes/refs, caller-preventable selection and resolved disabled semantics. TidalMenubarLinkItem renders a real consumer-owned anchor, preserves href/modifier/download/target behavior and blocks both navigation and consumer click handlers when either item disabled or anchorProps aria-disabled is true. Label and Separator forward primitive attributes/refs. Consumers own actions, links, checked/radio values and every state change; no file, request, network, storage or backend operation occurs.
