Back to all examples

Header with menu click event

ReactAngularWeb Components
const [deviceWidth, setDeviceWidth] = useState("5000");

  function handleMenuClick() {
    alert("Menu not being displayed and you can do anything");
  }
<GoabRadioGroup
        name="device"
        value={deviceWidth}
        onChange={(event: GoabRadioGroupOnChangeDetail) =>
          setDeviceWidth(event.value)
        }
      >
        <GoabRadioItem value="600" label="Desktop" />
        <GoabRadioItem value="5000" label="Mobile" />
      </GoabRadioGroup>

      <GoabAppHeader
        url="https://example.com"
        heading="Design System"
        onMenuClick={handleMenuClick}
        fullMenuBreakpoint={+deviceWidth}
      >
        <GoabAppHeaderMenu heading="Search" leadingIcon="search">
          <a href="#">Cases</a>
          <a href="#">Payments</a>
          <a href="#">Outstanding</a>
        </GoabAppHeaderMenu>
        <a href="#">Support</a>
        <a href="#" className="interactive">
          Sign in
        </a>
      </GoabAppHeader>

Handle custom menu click behavior in the app header, allowing you to intercept the mobile menu button click and implement custom functionality like custom navigation drawers.

When to use

Use this pattern when:

  • You need custom behavior when the mobile menu button is clicked
  • Building a custom navigation drawer or sidebar
  • The standard header menu behavior needs to be overridden
  • You want to control menu visibility programmatically

Considerations

  • Use the fullMenuBreakpoint prop to control when the hamburger menu appears
  • The onMenuClick handler fires when the menu button is clicked
  • Consider accessibility when implementing custom menu behavior
  • Test across different device widths to ensure proper behavior