# Megamenu

- Page: https://jiguang132.com/resources/daisyui/docs/megamenu
- Resource: daisyUI (https://jiguang132.com/resources/daisyui.md)
- All guides: https://jiguang132.com/resources/daisyui/docs.md

Compose navigation groups using the native structure and provide explicit touch/keyboard activation. CSS positioning does not guarantee collision handling, focus management or dismissal; constrain long content scrolling.

## Installation and initialization

```bash
npm install -D tailwindcss@4.2.1 @tailwindcss/cli@4.2.1 daisyui@5.7.47
```

This is a native CSS plugin, not a React component import. Build Tailwind 4 with the daisyUI plugin and load the generated stylesheet before copying an example. See the included setup guide; do not override an existing project's React or Tailwind versions blindly.

```css
@import "tailwindcss";
@plugin "daisyui" { themes: light --default, dark --prefersdark; }
```

## Source and executable behavior

Source files preserve the original code fences, including original comments and demo strings. The $$ class prefix placeholder must be resolved for your plugin configuration: without a prefix, $$btn becomes btn. Copy every listed source file for the chosen example, combine HTML/CSS/JS appropriately and implement native events. The preview's reviewed event adapters are not a backend or an automatically installed application runtime.

## Complete first example

```html
<!-- popovertarget must match the ID of the corresponding popover, and each ID must be unique -->
<button class="$$btn sm:hidden" popovertarget="my-megamenu-1">Menu</button>

<div class="$$megamenu max-sm:$$megamenu-vertical p-2 border border-base-300" id="my-megamenu-1" popover>
  <span class="$$megamenu-active"></span>

  <button popovertarget="a1">Services</button>
  <div id="a1" popover>
    <ul class="$$menu">
      <li><a>Enterprise</a></li>
      <li><a>CRM software</a></li>
      <li><a>Security</a></li>
      <li><a>Consulting</a></li>
    </ul>
  </div>

  <button popovertarget="a2">AI</button>
  <div id="a2" popover>
    <ul class="$$menu">
      <li><a>AI infrastructure</a></li>
      <li><a>Image generation</a></li>
      <li><a>MCP servers</a></li>
    </ul>
  </div>

  <button popovertarget="a3">Cloud Solutions</button>
  <div id="a3" popover>
    <ul class="$$menu">
      <li><a>Cloud computing</a></li>
      <li><a>Storage solutions</a></li>
      <li><a>Database services</a></li>
      <li><a>CDN performance</a></li>
    </ul>
  </div>
</div>
```

## All runnable examples

### Responsive megamenu with small vertical menus

`megamenu-2`

```bash
npm install -D tailwindcss@4.2.1 @tailwindcss/cli@4.2.1 daisyui@5.7.47
```

- `examples/megamenu/block-1.html`

### Megamenu with wide popovers and horizontal menus

`megamenu-3`

```bash
npm install -D tailwindcss@4.2.1 @tailwindcss/cli@4.2.1 daisyui@5.7.47
```

- `examples/megamenu/block-2.html`

### Megamenu with a menus and lots of links

`megamenu-4`

```bash
npm install -D tailwindcss@4.2.1 @tailwindcss/cli@4.2.1 daisyui@5.7.47
```

- `examples/megamenu/block-3.html`

### Megamenu in a navbar

`megamenu-5`

```bash
npm install -D tailwindcss@4.2.1 @tailwindcss/cli@4.2.1 daisyui@5.7.47
```

- `examples/megamenu/block-4.html`

### megamenu without arrows

`megamenu-6`

```bash
npm install -D tailwindcss@4.2.1 @tailwindcss/cli@4.2.1 daisyui@5.7.47
```

- `examples/megamenu/block-5.html`

### Megamenu in different sizes

`megamenu-7`

```bash
npm install -D tailwindcss@4.2.1 @tailwindcss/cli@4.2.1 daisyui@5.7.47
```

- `examples/megamenu/block-6.html`

## Theme, accessibility and verification

Use native data-theme boundaries. Verify keyboard operation, labels, visible focus, disabled/invalid states where applicable, light/dark, mobile and reduced motion. Check your target browser's dialog, popover and CSS feature support. CSS classes do not supply unimplemented JavaScript or business services. Clean up timers and third-party instances; copying a command is not installation success.

## Source and license

https://github.com/saadeghi/daisyui/tree/c51f50130ffefb293179e6fce8de7ad3f307e45f

JGuang authors these bilingual practical notes; this is not a claim of translating the complete upstream documentation. Original Markdown, code and CSS remain available in the source viewer. Preserve MIT and separate dependency notices. All native-package notices are included conservatively, including build tools; no build binary or remote demo image is redistributed. Replace remote media with assets you are authorized to use. Commercial templates are outside this integration.

---

Index of all JGuang resources: https://jiguang132.com/llms.txt
