HamburgerMenuButton

A button that invokes a menu (by default, a Drawer), usually to provide navigation and other UI on a mobile device.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent sit amet facilisis augue, sit amet dignissim felis. Curabitur in blandit justo. Duis ornare sem vitae enim feugiat, ultrices facilisis velit luctus. Aliquam porttitor sollicitudin nibh. Nulla lobortis quam venenatis, aliquam risus non, lacinia purus. Nulla a lectus non urna suscipit blandit id eget libero. Suspendisse ac bibendum arcu. Nunc consequat maximus aliquet. Nullam facilisis purus neque, sit amet egestas purus malesuada nec. In luctus tempus diam sit amet egestas.

Pellentesque ipsum dolor, consequat ut nunc at, congue semper nisl. Duis id cursus orci, sit amet sollicitudin libero. Proin a vehicula neque, eget placerat arcu. Nullam ultricies ullamcorper rutrum. Donec nunc augue, porttitor in metus sit amet, molestie egestas magna. Donec eget neque elementum, feugiat erat eu, sagittis felis. Quisque vitae urna rhoncus sapien condimentum suscipit. Cras luctus sollicitudin urna sit amet tincidunt. Suspendisse potenti. Fusce pretium libero et augue lobortis, quis iaculis est vehicula.

Nam varius et mauris dictum consectetur. Nulla venenatis, ante auctor scelerisque feugiat, nulla nisl elementum neque, nec facilisis quam erat eu orci. Integer rhoncus quam eu neque volutpat, et pulvinar nibh suscipit. In laoreet odio et sem bibendum rhoncus. Nunc dictum scelerisque gravida. Suspendisse volutpat nibh lectus, sit amet cursus ligula ultrices a. Mauris tempor eget risus sed laoreet. Proin fermentum lobortis sapien, et ultrices turpis vestibulum a. Morbi mollis nec orci at cursus. Nunc euismod neque dui, eu efficitur risus finibus sit amet. Duis felis augue, pretium vel felis a, scelerisque hendrerit nibh. Mauris efficitur consectetur molestie. Donec ac dolor nec odio mollis placerat. Etiam vel sem elementum, luctus nisi ac, volutpat ex. Curabitur auctor bibendum placerat. Aenean maximus ante nulla, eget vehicula tortor sagittis a.

Demo: A hamburger menu used to present navigation commands

Usage

import HamburgerMenuButton from 'elix/src/HamburgerMenuButton.js';
const hamburgerMenuButton = new HamburgerMenuButton(); // or
const hamburgerMenuButton = document.createElement('elix-hamburger-menu-button');

In HTML:

<script type="module" src="node_modules/elix/src/HamburgerMenuButton.js"></script>
<elix-hamburger-menu-button>
  <!-- Drawer contents go here -->
  <button>Home</button>
  <button>Products</button>
  <button>Search</button>
  <button>Account</button>
  <button>About Us</button>  
</elix-hamburger-menu-button>

Usability

The hamburger menu UI pattern is somewhat controversial. Some strengths:

  • It gives mobile apps a way to compact way to provide the user access to a large number of commands.
  • The pattern downplays commands that may not be frequently used, which can help keep users focused on a primary task.
  • The three line icon is a conventional visual cue to the button's purpose.

Disadvantages:

  • On its own, the icon may not be sufficient to let some users (particularly older users) understand its purpose.
  • A common placement for a hamburger menu button is in the upper-left corner, but it's awkward for a user to reach up to that location on a mobile device.
  • Burying important commands in a hamburger menu reduces discoverability, increases the time required to complete a task, and increases perceived task difficulty.

Further reading:

API

Built with mixin OpenCloseMixin.

menuButtonTag property

The tag used to create the menu button element.

Type: string

Default: 'elix-seamless-button'

Defined by menuTag

menuTag property

The tag used to create the menu (drawer).

Type: string

Default: 'elix-drawer'