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:
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
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;
},
});