Mobilenav
Mobile navigation panel with two menu slots, primary (top) and
secondary (bottom). Designed to live inside a drawer. The drawer
handles the slide-in, focus management, and dismissal; mobilenav provides
the menu structure and styling.
Stories show the panel on its own and composed inside a drawer.
Usage
When to use
- Off-canvas main navigation on small viewports
- Secondary "account" or "utility" menus that piggy-back on the primary mobile drawer
- Any narrow surface that needs a full vertical link list with optional collapsible submenus
When not to use
- Primary site navigation on desktop - use navbar
- Section navigation inside a sidebar - use sidenav
- Page-level table of contents - use toc
Do
- Compose mobilenav inside a drawer so the slide-in, backdrop, and focus behavior come from the drawer (use a modal drawer for a full focus trap)
- Keep top-level items short so they fit on narrow viewports without truncation
- Use the secondary slot for account, language, and utility links rather than mixing them into primary
Don't
- Don't render mobilenav directly on the page without a drawer wrapper - it has no dismissal behavior of its own
- Don't deeply nest submenus - mobile keyboards and one-thumb scroll make three or more levels hard to reach
- Don't replicate the desktop megamenu structure - mobilenav is intentionally vertical and one-column
API
Slots
| Slot | Required | Description |
|---|---|---|
primary | Yes | Primary menu items rendered at the top of the panel. Array of item objects with url, text, icon, description, badge, is_active_trail, is_current, is_disabled, is_external, is_section, is_divider, and nested items. |
secondary | - | Secondary menu items rendered at the bottom of the panel. Same item object shape as primary. |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
primary_label | string | Primary | Accessible label for the primary menu. |
secondary_label | string | Secondary | Accessible label for the secondary menu. |
is_collapsible | boolean | true | When true, parent items with nested children become inline expand/collapse triggers via the collapsible utility. |
classes | array | - | Additional CSS class words merged into the root element. |
attributes | object | - | Additional HTML attributes spread on the root element. |
Classes
| Class | Capability | Default | Description |
|---|---|---|---|
.subtle | Emphasis | - | Lower emphasis; a muted, quieter weight. |
.neutral | Emphasis | Yes | Default emphasis; the standard weight at balanced contrast. |
.accent | Emphasis | - | Higher emphasis; a stronger, louder weight. |
.sm | Size | - | Small. |
.md | Size | Yes | Medium. |
.lg | Size | - | Large. |
Examples
Sizes
The three size values, which scale the link font size and the link padding together.
Primary only
Panel rendered with only the primary slot - useful when secondary actions live elsewhere in the chrome.
In drawer
Mobilenav composed inside a drawer triggered by a hamburger button; backdrop click and Escape close the drawer with no story-side JS.
Accessibility
- WCAG 2.2 AA
- Each menu slot exposes a labeled
<nav>landmark viaaria-label - With
is_collapsible, each parent item gains a toggle button whosearia-expanded/aria-controlsare wired by the collapsible utility - When composed inside a modal drawer (
is_modal), focus is trapped inside it and returned to the trigger on close - Reduced-motion preferences are honored by the drawer slide animation
Dependencies
- drawer - off-canvas surface mobilenav is designed to live inside
- collapsible - drives the optional submenu expand/collapse when
is_collapsibleis set