Skip to content

Multiple MegaMenuDropdowns: Positioning and functionality issues with centered layout #1610

Open

Description

@SalvadorDalia
  • I have searched the Issues to see if this bug has already been reported
  • I have tested the latest version

We need to implement a navbar with multiple mega menu dropdowns that have consistent width and centered positioning, as shown in the attached image. However, we're encountering two main issues when trying to achieve this with flowbite-react components and Flotiq React Blocks PRO examples.

Image

Issues Encountered

Issue 1: MegaMenuDropdownToggle Approach

When using MegaMenuDropdownToggle components (from FlowbiteBlock PRO MegaMenuHeader example):

  • Only the first dropdown opens correctly
  • All subsequent dropdowns open the same (first) dropdown content
  • Setting custom id attributes and data-collapse-toggle properties doesn't resolve the issue
  • The menuOpen prop doesn't work as expected (menu opens by default regardless of the prop value)

Issue 2: MegaMenuDropdown with toggle Prop Approach

When using MegaMenuDropdown components with the toggle prop:

  • Multiple dropdowns work functionally (each opens its own content)
  • However, it's impossible to achieve consistent centered positioning
  • CSS positioning attempts fail:
    • theme.base with fixed, left-1/2, and -translate-x-1/2 classes don't center properly
    • Inline style prop with left: "50%" and transform: "translateX(-50%)" gets overridden
    • Custom theme styles are ignored or overridden by internal component styles

Issue 3: Multiple MegaMenu Components

When trying to use multiple MegaMenu components within a single NavbarCollapse:

  • Clicking one dropdown doesn't close others (multiple dropdowns can be open simultaneously)
  • Creates invalid HTML structure (nested <nav> elements within <ul>)

Steps to reproduce

Reproduce Issue 1 (MegaMenuDropdownToggle)

  1. Visit the CodeSandbox example
  2. Ensure preview is at least 1280px width (desktop view)
  3. Click "Company" in the first navbar
  4. Click "Marketing" in the first navbar

Current behavior

Both buttons open the same dropdown content.

Expected behavior

Each button should open its own unique dropdown content, with proper toggle behavior (clicking one closes the other).

Reproduce Issue 2 (MegaMenuDropdown styling)

  1. Visit the same CodeSandbox example
  2. Ensure preview is at least 1280px width (desktop view)
  3. Click "Company" in the second navbar
  4. Click "Marketing" in the second navbar
  5. Observe the positioning of the dropdown menus

Current behavior

Dropdowns open but are not centered consistently. Styling attempts are ignored.

Expected behavior

All dropdowns should be centered horizontally on the page with consistent positioning, similar to the first navbar's visual appearance.

Context

This issue occurs across all browsers, screen sizes, and operating systems.

Demo Repository: https://codesandbox.io/p/github/SalvadorDalia/flowbite-mega-menu/main

Expected Solution

We need a way to:

  1. Create multiple functional mega menu dropdowns within a single navbar
  2. Ensure each dropdown opens its own unique content
  3. Provide reliable styling options for consistent centered positioning
  4. Maintain proper HTML semantics and accessibility
  5. Support proper toggle behavior (opening one closes others)

Activity

  1. changed the title [-]It is not possible to have two MegaDropdowns in one MegaMenu[/-] [+]Multiple MegaMenuDropdowns: Positioning and functionality issues with centered layout[/+] on Aug 1, 2025
  2. added theissue type on Aug 1, 2025
  3. SalvadorDalia commented on Aug 11, 2025

    @SalvadorDalia
    Author

    Hi, is there any update on this issue? Could we please get an estimated time for the patch to be released?

  4. SutuSebastian commented on Aug 12, 2025

    @SutuSebastian
    Collaborator

    Hey there, thanks for reporting.

    I know @connerdavis47 / @tulup-conner worked on this component, maybe he can bring more light on what's happening here.

  5. SalvadorDalia commented on Sep 22, 2025

    @SalvadorDalia
    Author

    Hi,

    we're currently blocked by the dropdown behaviour and styling inconsistencies, and would really appreciate any guidance or an estimated timeline for a fix.

    Let me know if there's anything we can do to help test or clarify further.

    Thanks for your work on this!

  6. jorj-pineda commented on Aug 12, 2026

    @jorj-pineda

    Opened #1685, which fixes the multiple-dropdown behaviour reported here (issues 1 and 3) — each toggle now controls its own dropdown, and opening one closes the others. There is a short demo video on the PR.

    I left the centred-positioning problem (issue 2) out deliberately: className is forwarded to both the trigger and the floating panel, and the panel carries inline positioning styles from Floating UI that a utility class cannot override, so fixing it properly needs an API decision from the maintainers. I have written up the reasoning in the PR and would be glad to follow up once there is a preferred direction.

    @SalvadorDalia — you mentioned you could help test. If you are able to try the branch against your setup, confirmation that it unblocks the multiple-dropdown part of your case would be useful evidence for the maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmedThis bug was confirmed

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions