Skip to main content

BurgerMenu

Note: This component is to be used only under the scope of the page layouts UX patterns and not to be used in isolation or custom scenarios.

For documentation about the burger menu component for Header UX patterns, see this page.

Usage

Overview

The burger menu is a layout component that provides a collapsible side container, typically used for navigation on smaller screens. It is triggered by a button and reveals a panel for holding other components.

As part of the Jutro flexible page layout system, this component's sole responsibility is the layout and behavior of the menu panel (that is, opening and closing). It is content-agnostic, meaning you are responsible for populating it with menu items, links, and implementing any associated routing.

When to use

Use the burger menu when you need to:

  • Provide a compact navigation solution for responsive designs, especially for tablet and mobile viewports.
  • House secondary actions or links that don't need to be persistently visible on the page.
  • Build a custom page structure using the new page layout components that requires a toggleable side menu.

Formatting

Anatomy

A website header with the hamburger menu icon

The opened navigation menu panel

The burger menu component consists of the following elements:

  1. Trigger button: An icon button that toggles the visibility of the menu panel. The appearance is handled by the component.
  2. Menu Panel: A container that appears when the menu is opened. You can place any child components inside this panel, such as navigation lists, search fields, or action buttons.

Placement

The burger menu is designed to be placed within a header panel or at the top level of a custom page layout.

Behavior

  • Interaction: Selecting the trigger button opens the menu panel. The panel can be closed by selecting the default close button, by clicking the area outside the menu, or by using a custom button.
  • State: The component's visibility is controlled programmatically using the open and onOpenChange props.

Best practices

Keep it lightweight

The burger menu is a container for other components. To ensure a good user experience, populate it with simple and focused content. Avoid overloading the panel with too many items or deeply nested structures.

Provide a clear exit

Users must always have an obvious way to close the menu. The component includes a close button by default. If you use the hideCloseButton prop, be sure to provide a custom element that allows users to dismiss the panel.

Use concise labels

If you add navigation links or other interactive elements inside the burger menu, their labels must be short, clear, and predictable. Use nouns for links to destinations (for example, "Dashboard," "Settings") and verbs for actions (for example, "Add user," "Export data").