# Dropdown menu

Grouped actions, selections and nested menus.

Access: free. Category: Navigation. Kind: composite.

## When to use

- Use it when a page needs grouped actions, selections and nested 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 dropdown 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 Dropdown menu

```sh
npx shadcn@latest add https://tidalui.com/r/dropdown-menu.json
```

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

## Minimal example

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

## Structured props

- `TidalDropdownMenu.theme?: "light" | "dark" | undefined` (default "light"): Optional theme value accepted by this exported component.
- `TidalDropdownMenuItem.destructive?: boolean | undefined`: Optional destructive value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/dropdown-menu.tsx) | [Manifest](https://tidalui.com/examples/dropdown-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 { Archive, ChevronDown, Copy, Ellipsis, LayoutTemplate, Undo2 } from "lucide-react";

import { TidalDropdownMenu, TidalDropdownMenuCheckboxItem, TidalDropdownMenuContent, TidalDropdownMenuItem, TidalDropdownMenuLabel, TidalDropdownMenuRadioGroup, TidalDropdownMenuRadioItem, TidalDropdownMenuSeparator, TidalDropdownMenuSub, TidalDropdownMenuSubContent, TidalDropdownMenuSubTrigger, TidalDropdownMenuTrigger } from "./components/ui/dropdown-menu";

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



const tidalExampleStyles = ".tidal-scope .menu-demo-specimen {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: flex-start;\n  gap: 12px;\n  width: 100%;\n  min-height: 330px;\n  padding: 28px 24px;\n  color: var(--t-ink);\n}\n.tidal-scope .menu-demo-toolbar {\n  display: flex;\n  min-width: 0;\n  align-items: center;\n  justify-content: center;\n}\n.tidal-scope .menu-demo-trigger-chevron {\n  transition: rotate 240ms var(--t-ease-out);\n}\n.tidal-scope .menu-demo-feedback {\n  max-width: 260px;\n  min-height: 17px;\n  margin: 0;\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.5;\n  text-align: center;\n}\n@media (max-width: 600px) {\n  .tidal-scope .menu-demo-specimen {\n    min-height: 300px;\n    padding: 24px 16px;\n  }\n}\n@media (prefers-reduced-motion: reduce) {\n  .tidal-scope .menu-demo-trigger-chevron {\n    transition: none;\n  }\n}";

export function DropdownMenuDemo({
  theme = "light",
}: {
  theme?: "light" | "dark";
}) {
  const [open, setOpen] = useState(false);
  const [duplicateCount, setDuplicateCount] = useState(1);
  const [pinned, setPinned] = useState(false);
  const [view, setView] = useState("overview");
  const [archived, setArchived] = useState(false);
  const [message, setMessage] = useState("");

  return (
    <section className="menu-demo-specimen" aria-label="Dropdown menu example">
      <div className="menu-demo-toolbar">
        <TidalDropdownMenu theme={theme} open={open} onOpenChange={setOpen}>
          <TidalDropdownMenuTrigger aria-label="Note actions">
            <Ellipsis size={17} aria-hidden="true" />
            <span>Actions</span>
            <ChevronDown
              className="menu-demo-trigger-chevron"
              size={14}
              aria-hidden="true"
            />
          </TidalDropdownMenuTrigger>
          <TidalDropdownMenuContent align="center" aria-label="Note actions">
            <TidalDropdownMenuLabel>NOTE ACTIONS</TidalDropdownMenuLabel>
            <TidalDropdownMenuItem
              disabled={archived || duplicateCount >= 9}
              onSelect={() => {
                setDuplicateCount((count) => count + 1);
                setMessage("A local note duplicate is ready in this preview.");
              }}
            >
              <Copy size={16} aria-hidden="true" />
              <span className="tidal-menu-item-copy">Duplicate note</span>
            </TidalDropdownMenuItem>
            <TidalDropdownMenuCheckboxItem
              disabled={archived}
              checked={pinned}
              onSelect={(event) => event.preventDefault()}
              onCheckedChange={(checked) => {
                setPinned(checked === true);
                setMessage(
                  checked
                    ? "Note pinned in this preview."
                    : "Note unpinned in this preview.",
                );
              }}
            >
              Pin note
            </TidalDropdownMenuCheckboxItem>
            <TidalDropdownMenuSub>
              <TidalDropdownMenuSubTrigger disabled={archived}>
                <LayoutTemplate size={16} aria-hidden="true" />
                <span className="tidal-menu-item-copy">
                  Reading layout
                  <small>{view === "reading" ? "Reading" : "Overview"}</small>
                </span>
              </TidalDropdownMenuSubTrigger>
              <TidalDropdownMenuSubContent aria-label="Reading layout">
                <TidalDropdownMenuLabel>LAYOUT</TidalDropdownMenuLabel>
                <TidalDropdownMenuRadioGroup
                  value={view}
                  onValueChange={(next) => {
                    setView(next);
                    setMessage(
                      `${next === "reading" ? "Reading" : "Overview"} layout selected.`,
                    );
                  }}
                >
                  <TidalDropdownMenuRadioItem
                    value="overview"
                    onSelect={(event) => event.preventDefault()}
                  >
                    Overview
                  </TidalDropdownMenuRadioItem>
                  <TidalDropdownMenuRadioItem
                    value="reading"
                    onSelect={(event) => event.preventDefault()}
                  >
                    Reading
                  </TidalDropdownMenuRadioItem>
                </TidalDropdownMenuRadioGroup>
              </TidalDropdownMenuSubContent>
            </TidalDropdownMenuSub>
            <TidalDropdownMenuSeparator />
            <TidalDropdownMenuItem
              destructive={!archived}
              onSelect={() => {
                setArchived((value) => !value);
                setMessage(
                  archived
                    ? "Note restored in this preview."
                    : "Note archived in this preview.",
                );
              }}
            >
              {archived ? (
                <Undo2 size={16} aria-hidden="true" />
              ) : (
                <Archive size={16} aria-hidden="true" />
              )}
              <span>{archived ? "Restore note" : "Archive note"}</span>
            </TidalDropdownMenuItem>
          </TidalDropdownMenuContent>
        </TidalDropdownMenu>
      </div>
      <p className="menu-demo-feedback" role="status" aria-live="polite">
        {message}
      </p>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <DropdownMenuDemo />
    </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-menu-sub-offset","--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."}

Compound Radix Dropdown Menu2.2.1 family. TidalDropdownMenu forwards Root open/defaultOpen/onOpenChange/modal with theme(light default)/dir(ltr default); pass matching theme and direction explicitly for Portal surfaces. Trigger forwards native button props/ref, including disabled/asChild. Content/SubContent forward Radix positioning, collision, event, focus and ref props; default sideOffset8/6, collisionPadding12 and looptrue. Content/SubContent own their Portal and styled DOM surface; asChild/forceMount are not exposed and no additional Portal wrapper is needed. Item forwards native Radix Item props/ref/asChild and optional destructive styling, but never assumes an action or confirmation. Provide clear action text; icons should be aria-hidden. Label/Separator/Group and Sub/SubTrigger compose grouped/nested menus; RadioGroup/RadioItem use controlled value/onValueChange; CheckboxItem uses controlled boolean/indeterminate checked/onCheckedChange. Only Root provides defaultOpen. Menu choices are not native form fields and do not implement defaultValue/defaultChecked. Checkbox/Radio/SubTrigger supply their internal indicator/chevron and do not support asChild; Item and Trigger support asChild for a single native element. Item children remain yours, including icons, descriptions and native links. Use onSelect(event) and event.preventDefault() to keep a choice menu open; onCheckedChange/onValueChange remain consumer-owned. Keyboard Enter/Space/Down opens, arrows/Home/End/typeahead navigate and skip disabled items, Right/Left enter/leave submenus according to dir, Escape closes and returns focus. Shortcut labels are decorative unless consumers implement handlers. Persistent measured highlight preserves contrast, adapts to surface resize/scroll and excludes disabled items. Portal popups fit the viewport and scroll internally, with44px rows and visible keyboard outlines. Scoped tidal.css/dropdown-menu.css and finite reduced-motion-safe surface/highlight/control animation. No form field, navigation, network, storage or destructive action is introduced by the component.
