---
title: Mobile Menu Blocks for Astro
description: "Astro mobile navigation with nested drawer panels and swipe gestures."
seo:
    title: "Astro Mobile Menu blocks: examples and source"
sidebar:
    label: "Mobile Menu"
related:
    - /blocks
    - /components
    - /docs/astro-business-websites
mode: wide
---

This block uses the [Drawer](/ui/components/drawer) component. Items with child
links open a new drawer panel. Child links can contain more submenus. Swipe,
press Escape, or select Back to return one level. Selecting a destination
closes the full menu. A parent with an `href` keeps its destination under Overview.
Omit `href` when a parent only groups related items. Its submenu uses
`DrawerMenuGroup label` to show a styled group label instead of an Overview link.
The footer contains the actions and the default slot.

## Navigation

Show navigation groups inside the mobile menu panel.

```astro
---
import MobileMenuBlock from "@/components/blocks/mobile-menu/mobile-menu-1.astro"
---

<div class="flex items-center justify-between p-4">
  <span class="font-semibold">
    gnostic <span class="text-muted-foreground">AI</span>
  </span>
  <MobileMenuBlock
    title="gnostic AI project menu"
    navigation={[
      { label: "Sample projects", href: "/blocks/gallery#project-columns" },
      {
        label: "Services",
        href: "/blocks/services#image-grid",
        icon: "workflow",
        links: [
          {
            label: "Workflow review",
            href: "/blocks/pricing#comparison",
            icon: "clipboard-list",
          },
          {
            label: "Pilot tests",
            icon: "list-checks",
            links: [
              { label: "Ticket routing", href: "/blocks/article#image-header" },
              {
                label: "Invoice intake",
                href: "/blocks/article#editorial-article",
              },
              {
                label: "Reply review",
                href: "/blocks/article#centered-header",
              },
            ],
          },
          {
            label: "Pilot handoff",
            href: "/blocks/features#illustrated-timeline",
            icon: "list-checks",
          },
        ],
      },
      {
        label: "Resources",
        href: "/blocks/articles#text-grid",
        links: [
          { label: "Routing test kit", href: "/blocks/product#featured" },
          { label: "Pilot FAQ", href: "/blocks/faqs#split", active: true },
          { label: "Test kit catalog", href: "/blocks/products#list" },
        ],
      },
      { label: "Pilot steps", href: "/blocks/services#process" },
    ]}
    actions={[
      {
        label: "View the project brief",
        href: "/blocks/contact#editorial-contact",
      },
    ]}
  />
</div>
```

```sh
bunx --bun shadcn@latest add @gnostic/mobile-menu-1
```

Open **Services** and select **Pilot tests** to find the routing, invoice, and reply field notes.
**Overview** opens the services page. **Pilot tests** groups the three links.
Under **Resources**, **Pilot FAQ** shows how to mark the current page.
Each panel opens from the right by default. Set `position="bottom"` to use bottom panels with swipe handles.

## Installation

```sh
bunx --bun shadcn@latest add @gnostic/mobile-menu-1
```

## Header option

All five [header blocks](/ui/blocks/header) accept `mobileMenu="drawer"`.
They use the same navigation data and pass `actions`, plus
`slot="mobile"`, to this block. The default remains `mobileMenu="sheet"`.

```astro
<HeaderBlock
  logo={logo}
  navigation={navigation}
  actions={actions}
  mobileMenu="drawer"
>
  <a slot="mobile" href="/support">Support</a>
</HeaderBlock>
```

The header hides the trigger at `1024px` and closes an open drawer at that width.

## Props

### MobileMenuProps

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/mobile-menu/types.ts"
    name="MobileMenuProps"
/>

### MobileMenuLink

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/mobile-menu/types.ts"
    name="MobileMenuLink"
/>

### MobileMenuNavigationItem

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/mobile-menu/types.ts"
    name="MobileMenuNavigationItem"
/>

### MobileMenuButton

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/mobile-menu/types.ts"
    name="MobileMenuButton"
/>

The standalone block has no breakpoint restriction. Use `class="lg:hidden"`
and `closeOnMedia="(min-width: 1024px)"` when you pair it with desktop navigation.
Custom footer links can use `DrawerClose as="a"` to close on selection.
Use `class={buttonVariants()}` when that control should look like a button.

## Choose a mobile menu layout

Choose a mobile menu for navigation that does not fit the desktop header at smaller widths. Keep its destinations aligned with the desktop navigation.

## Pass content from Astro

Pass navigation groups, optional actions, and trigger/title labels. Position and variant props change the panel layout. Use closeOnMedia where supported to close a panel when the page returns to a desktop layout.

## Responsive layout and images

Test opening, Escape, link activation, and focus return with a keyboard. A menu with many links needs scrolling that leaves the close control reachable. Logo or icon artwork needs a text name when it is the only visible mark.

## Compose the next section

Use [Header](/ui/blocks/header) for the complete shell and [Sheet](/ui/components/sheet) or [Drawer](/ui/components/drawer) for lower-level panel composition.
