# Reuse Discourse Hamburger Functionality

**URL:** <https://meta.discourse.org/t/reuse-discourse-hamburger-functionality/85578>\
**Category:** Product Support\
**Created:** [April 17, 2018, 9:42pm UTC](https://meta.discourse.org/t/reuse-discourse-hamburger-functionality/85578 "2018-04-17T21:42:12Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)\
**Post date:** [April 20, 2018, 6:18pm UTC](https://meta.discourse.org/t/reuse-discourse-hamburger-functionality/85578/7 "2018-04-20T18:18:34Z")

</div>

Ah ok in that case you’re looking at something more like what @simon mentioned in the brand header theme component, I was attaching the action to the existing header widget… the brand header adds it to a new one. The new widget here w/ toggleHamburger:

```plaintext
 api.createWidget('brand-header', {
    tagName: 'header.b-header.clearfix',
    buildKey: () => `header`,
  
    defaultState() {
      let states = {
        hamburgerVisible: false
      };
  
      return states;
    },
  
    toggleHamburger() {
      this.state.hamburgerVisible = !this.state.hamburgerVisible;
    },

```

and then the action is added to an HTML element in another widget here

```plaintext
api.createWidget('brand-header-icons', {
    tagName: 'ul.icons.clearfix',
  
    buildAttributes() {
      return { role: 'navigation' };
    },
  
    html(attrs) {
      const hamburger = this.attach('header-dropdown', {
                              title: 'hamburger_brand_menu',
                              icon: 'bars',
                              iconId: 'toggle-hamburger-brand-menu',
                              active: attrs.hamburgerVisible,
                              action: 'toggleHamburger'
                            });
      const icons = [hamburger];
      return icons;
    },
  });

```

---

_[View the full topic](https://meta.discourse.org/t/reuse-discourse-hamburger-functionality/85578)._
