# Hoe toon ik een widget in het hamburger menu?

**URL:** <https://meta.discourse.org/t/how-to-display-a-widget-in-the-hamburger-menu/167022>\
**Category:** Product Support\
**Created:** [12 oktober 2020 om 21:02 UTC](https://meta.discourse.org/t/how-to-display-a-widget-in-the-hamburger-menu/167022 "2020-10-12T21:02:38Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [12 oktober 2020 om 22:16 UTC](https://meta.discourse.org/t/how-to-display-a-widget-in-the-hamburger-menu/167022/5 "2020-10-12T22:16:58Z")

</div>

Not that I know. Should I?

This code works, however, as it properly adds the element in the hamburger menu:

```js
api.decorateWidget("hamburger-menu:generalLinks", function(helper) {
  return {href: "", rawLabel: "test"}
});

```

 ![image](https://global.discourse-cdn.com/meta/original/3X/b/e/bec720699d8f599d5f0d8f821a8c2c5752d3b204.png)

But I don’t know if I can call `showModal("fareharbor");` without using a widget.

And Happy Birthday. 🙂

edit:  
Heres’ my full code:

```js
const showModal = require("discourse/lib/show-modal").default;

api.createWidget("modal-button", {
  tagName: "a.test",

  html() {
    return "Open Modal";
  },

  click() {
    showModal("fareharbor");
  }
});

// doesn't work
api.decorateWidget("hamburger-menu:generalLinks", function(helper) {
  return [helper.widget.attach('modal-button')];
});

// works
api.decorateWidget("hamburger-menu:generalLinks", function(helper) {
  return {href: "", rawLabel: "test"}
});

```

The `return [helper.widget.attach('modal-button')];` part creates an empty link:

```html
<li><a class="widget-link" href="" title=""><span class="d-label"></span></a></li>

```

---

_[View the full topic](https://meta.discourse.org/t/how-to-display-a-widget-in-the-hamburger-menu/167022)._
