> ## Documentation Index
> Fetch the complete documentation index at: https://neo.tvk.company/llms.txt
> Use this file to discover all available pages before exploring further.

# Dropdown Menu

> A contextual action menu that appears when triggered, containing organized sections.

## Examples

<Tabs>
  <Tab title="Basic Usage">
    <Frame caption="Simple dropdown menu with action items triggered by a button.">
      <img src="https://mintcdn.com/tvk/M1ZGdn8TY0ukkJe8/images/widgets/pickers/dropdown-menu/dropdown_menu_basic_light.png?fit=max&auto=format&n=M1ZGdn8TY0ukkJe8&q=85&s=2454810d0fc38a346e81ce87d4329fc6" alt="Basic dropdown menu example" noZoom className="block dark:hidden" width="1536" height="512" data-path="images/widgets/pickers/dropdown-menu/dropdown_menu_basic_light.png" />

      <img src="https://mintcdn.com/tvk/M1ZGdn8TY0ukkJe8/images/widgets/pickers/dropdown-menu/dropdown_menu_basic_dark.png?fit=max&auto=format&n=M1ZGdn8TY0ukkJe8&q=85&s=6c7360d38370fc7801cfa2b68734b5fc" alt="Basic dropdown menu example" noZoom className="hidden dark:block" width="1536" height="512" data-path="images/widgets/pickers/dropdown-menu/dropdown_menu_basic_dark.png" />
    </Frame>

    <CodeGroup>
      ```dart Simple Menu lines focus={1-35, 40} theme={null}
      NeoDropdownMenu(
        isOpen: isMenuOpen.value, // Using hooks
        onOpenChanged: (value) => isMenuOpen.value = value,
        sections: [
          NeoDropdownMenuSection(
            children: [
              NeoDropdownMenuItem(
                label: "Open",
                icon: PhosphorIcons.eye,
                onTap: () {
                  // Handle open action
                  isMenuOpen.value = false;
                },
              ),
              NeoDropdownMenuItem(
                label: "Edit",
                icon: PhosphorIcons.pencil,
                onTap: () {
                  // Handle edit action
                  isMenuOpen.value = false;
                },
              ),
              NeoDropdownMenuItem(
                label: "Delete",
                icon: PhosphorIcons.trash,
                isDanger: true,
                onTap: () {
                  // Handle delete action
                  isMenuOpen.value = false;
                },
              ),
            ],
          ),
        ],
        trigger: NeoButton(
          variant: .outlined,
          icon: PhosphorIconsRegular.dotsThreeVertical,
          onPressed: () => isMenuOpen.value = !isMenuOpen.value,
        ),
      ),
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Profile Menu">
    <Frame caption="Profile dropdown menu with actions and sections.">
      <img src="https://mintcdn.com/tvk/M1ZGdn8TY0ukkJe8/images/widgets/pickers/dropdown-menu/dropdown_menu_profile_light.png?fit=max&auto=format&n=M1ZGdn8TY0ukkJe8&q=85&s=02d9fd0efa3b8a4c17474d8c94d9cf98" alt="Profile dropdown menu example" noZoom className="block dark:hidden" width="1536" height="512" data-path="images/widgets/pickers/dropdown-menu/dropdown_menu_profile_light.png" />

      <img src="https://mintcdn.com/tvk/M1ZGdn8TY0ukkJe8/images/widgets/pickers/dropdown-menu/dropdown_menu_profile_dark.png?fit=max&auto=format&n=M1ZGdn8TY0ukkJe8&q=85&s=f1a3f091b8a1da46abcbc30a568ad75f" alt="Profile dropdown menu example" noZoom className="hidden dark:block" width="1536" height="512" data-path="images/widgets/pickers/dropdown-menu/dropdown_menu_profile_dark.png" />
    </Frame>

    <CodeGroup>
      ```dart Profile Menu lines focus={1-38, 58} theme={null}
      NeoDropdownMenu(
        isOpen: isMenuOpen.value, // Using hooks
        onOpenChanged: (value) => isMenuOpen.value = value,
        sections: [
          NeoDropdownMenuSection(
            children: [
              NeoDropdownMenuItem(
                label: "Profile",
                icon: PhosphorIcons.user,
                onTap: () {
                  // Navigate to profile
                  isMenuOpen.value = false;
                },
              ),
              NeoDropdownMenuItem(
                label: "Settings",
                icon: PhosphorIcons.gear,
                onTap: () {
                  // Navigate to settings
                  isMenuOpen.value = false;
                },
              ),
            ],
          ),
          NeoDropdownMenuSection(
            children: [
              NeoDropdownMenuItem(
                label: "Sign Out",
                icon: PhosphorIcons.signOut,
                onTap: () {
                  // Handle sign out
                  isMenuOpen.value = false;
                },
              ),
            ],
          ),
        ],
        trigger: GestureDetector(
          onTap: () => isMenuOpen.value = !isMenuOpen.value,
          child: Container(
            width: 42,
            height: 42,
            decoration: BoxDecoration(
              shape: .circle,
              color: theme.colors.bgSecondary,
              image: const DecorationImage(
                image: AssetImage('assets/images/profile_picture.png'),
                fit: .cover,
              ),
            ),
            child: Icon(
              PhosphorIconsRegular.user,
              size: 16,
              color: theme.colors.fgPrimary,
            ),
          ),
        ),
      ),
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Custom Sizing">
    <Frame caption="Dropdown menus with custom width constraints.">
      <img src="https://mintcdn.com/tvk/M1ZGdn8TY0ukkJe8/images/widgets/pickers/dropdown-menu/dropdown_menu_sizing_light.png?fit=max&auto=format&n=M1ZGdn8TY0ukkJe8&q=85&s=ed6d0da639ac727d7336b13a03745f80" alt="Custom sizing dropdown menu example" noZoom className="block dark:hidden" width="1536" height="512" data-path="images/widgets/pickers/dropdown-menu/dropdown_menu_sizing_light.png" />

      <img src="https://mintcdn.com/tvk/M1ZGdn8TY0ukkJe8/images/widgets/pickers/dropdown-menu/dropdown_menu_sizing_dark.png?fit=max&auto=format&n=M1ZGdn8TY0ukkJe8&q=85&s=8df81a614d6207b3253d42888a035c6b" alt="Custom sizing dropdown menu example" noZoom className="hidden dark:block" width="1536" height="512" data-path="images/widgets/pickers/dropdown-menu/dropdown_menu_sizing_dark.png" />
    </Frame>

    <CodeGroup>
      ```dart Custom Width lines focus={1-17, 22} theme={null}
      NeoDropdownMenu(
        isOpen: isMenuOpen.value,
        dropdownWidth: 96,
        onOpenChanged: (value) => isMenuOpen.value = value,
        sections: [
          NeoDropdownMenuSection(
            children: [
              NeoDropdownMenuItem(
                label: "Hey",
                onTap: () {
                  isMenuOpen.value = false;
                },
              ),
            ],
          ),
        ],
        trigger: NeoButton(
          variant: .outlined,
          label: "Custom Width",
          onPressed: () => isMenuOpen.value = !isMenuOpen.value,
        ),
      ),
      ```

      ```dart Fit to Trigger lines focus={1-25, 30} theme={null}
      NeoDropdownMenu(
        isOpen: isMenuOpen.value,
        fitToTrigger: true,
        onOpenChanged: (value) => isMenuOpen.value = value,
        sections: [
          NeoDropdownMenuSection(
            children: [
              NeoDropdownMenuItem(
                label: "PDF",
                icon: PhosphorIcons.filePdf,
                onTap: () {
                  isMenuOpen.value = false;
                },
              ),
              NeoDropdownMenuItem(
                label: "CSV",
                icon: PhosphorIcons.fileCsv,
                onTap: () {
                  isMenuOpen.value = false;
                },
              ),
            ],
          ),
        ],
        trigger: NeoButton(
          variant: .filled,
          label: "A long export button with text",
          onPressed: () => isMenuOpen.value = !isMenuOpen.value,
        ),
      ),
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## Properties

### Required

<ParamField path="isOpen" type="bool" required>
  Whether the dropdown menu is currently visible. Control this with state management to show/hide the menu.
</ParamField>

<ParamField path="onOpenChanged" type="ValueChanged<bool>" required>
  Callback function called when the menu's visibility changes. Use this to update your state when the menu is dismissed by clicking outside.
</ParamField>

<ParamField path="sections" type="List<NeoDropdownMenuSection>" required>
  A list of sections containing the menu items. Each section groups related actions together.
</ParamField>

<ParamField path="trigger" type="Widget" required>
  The widget that triggers the dropdown menu. Can be any widget, but typically a button or clickable element.
</ParamField>

### Layout

<ParamField path="dropdownWidth" type="double">
  Fixed width for the dropdown menu. If not provided, the menu will size itself to fit the content.
</ParamField>

<ParamField path="fitToTrigger" type="bool" default="false">
  Whether the dropdown should match the width of the trigger widget.
</ParamField>

<ParamField path="constrainedHeight" type="bool" default="false">
  Whether the dropdown should have a maximum height with scrolling for large lists.
</ParamField>

## Section Properties

The `NeoDropdownMenuSection` class represents grouped sections within the dropdown:

### Required

<ParamField path="children" type="List<NeoDropdownMenuItem>" required>
  A list of menu items within this section.
</ParamField>

### Content

<ParamField path="label" type="String">
  The section header text. If not provided, the section will not display a header.
</ParamField>

### Layout

<ParamField path="hasDivider" type="bool" default="true">
  Whether to show a divider line between this and other sections.
</ParamField>

## Item Properties

The `NeoDropdownMenuItem` class represents individual actionable menu items:

### Required

<ParamField path="label" type="String" required>
  The text displayed for the menu item.
</ParamField>

<ParamField path="onTap" type="VoidCallback" required>
  Callback function executed when the item is tapped.
</ParamField>

### Content

<ParamField path="icon" type="PhosphorIconData Function(PhosphorIconsStyle)">
  An optional icon to display before the label.
</ParamField>

### Styling

<ParamField path="isDanger" type="bool" default="false">
  Whether the item represents a destructive action. When true, the item appears with danger styling (typically red).
</ParamField>

## Best Practices

* **State Management**: The menu doesn't close automatically when items are tapped, giving you control over when to dismiss it. Typically, you'll want to close the menu (`isOpen = false`) in item `onTap` callbacks, but you can choose to do this before or after executing your action depending on your needs.
* **Destructive Actions**: Use `isDanger: true` for destructive actions like delete, remove, or clear operations.

## Integration Notes

* **Auto Dismiss**: The menu automatically closes when clicking outside the dropdown area.
* **Positioning**: The menu intelligently positions itself relative to the trigger to stay within screen bounds.
