Nav Drawer
Primary navigation below --fgd-nav-inline-n-above: a menu Button that opens a modal Dialog sheet in the header's own scope. It is the single owner of the mobile drawer; put it in the Navigation Bar's drawer slot, which removes it from the inline threshold.
import {
NavDrawer,
NavDrawerGroup,
NavDrawerLink,
NavDrawerFooter,
} from '@fairgarden/design/navigation/nav-drawer'
The menu Button shows the menu icon and "Menu", which swap to × and "Close" while the drawer is open. Below 360 px the label drops to the icon, and it stays the accessible name. The sheet is full screen below --md-n-above. From there it is a 480 px side sheet docked to the end edge, with a --border-size-2-25 inner edge, and the page beside it is left unpainted and inert. No backdrop or tint is painted. The sheet grows out of the menu Button by the Outline Morph: the Button's ring runs out to the sheet's inner edge and off the screen's other edges, and the close lands back on the Button. morph={false} opens and closes it at once. The sheet re-declares the header's preset, so a page-ground header gives a page-ground sheet and a night header a night one, never a white overlay.
The drawer
The drawer
The sheet repeats the header's bar, with the close control where the menu Button was. In the Navigation Bar's drawer slot the drawer measures the menu Button as the sheet opens and moves its bar down to the header's, past the header's seams and brand strip, so the close control covers the Button exactly and the morph starts and lands on that one box. Each NavDrawerGroup is an independent Collapsible, so several may be open. Its row is set in the display serif and carries the expand/collapse glyph: arrows point out in --role-muted when collapsed and in, in --primary12, when expanded. The glyph swaps and never rotates. Child links sit on a hairline indent guide. A NavDrawerLink at the top level is a direct link styled as a row. The group holding the current page opens by default, and the current link takes the --border-size-2-25 start-edge bar and weight 700. The list scrolls in a Scroll Area between the fixed bar and the NavDrawerFooter, which holds the action pill, the utility links and the locale Select. Pass sections (the shared navigation data from @fairgarden/design/utils/navigation) to build the rows from the object that also feeds the Navigation Menu and the footer sitemap: each section with links becomes a group, opening with its landing page, and a section with only an href a direct link. Or pass nav, a complete navigation such as the Docs Layout's Sidebar Nav, which fills the Scroll Area in place of the drawer's own list; its DocsLayoutDrawer does this for you. Focus moves to the first row (with nav, to its current page's link), stays trapped, and returns to the menu Button on close. If the window widens past the inline threshold while the drawer is open, it closes and focus moves to the matching bar item, or to what inlineTarget returns. The menu Button's and the close control's labels reserve 48 px, so the web font arriving never moves the header's end.
API Reference
NavDrawer
The navigation drawer below --fgd-nav-inline-n-above [D183]: the menu
Button (the menu icon plus “Menu”; × plus “Close” while open) and a
modal Dialog sheet in the header’s own scope, full screen below
--md-n-above and a 480 px side sheet with a --border-size-2–25 inner edge
from it. The sheet repeats the header’s bar with the close control where
the menu Button was, lists independent Collapsible groups and direct
links in a Scroll Area, and keeps its footer fixed. Focus moves to the
first row, is trapped, and returns to the menu Button; no backdrop is
painted. If the viewport reaches the inline threshold while open, it
closes and focus goes to the matching bar item. Put it in the Navigation
Bar’s drawer slot.
| Prop | Type | Description |
|---|---|---|
label | | The menu Button’s label, authored in title case [D160]. Default “Menu”. |
defaultOpen | | Initial open state. Default |
open | | Controlled open state. |
onOpenChange | | Called when the drawer opens or closes. |
closeLabel | | The close control’s label. Default “Close”. |
currentPath | | The current page’s URL path. Default: the Navigation Bar’s. |
footer | | The fixed footer zone: a |
inlineTarget | | Where focus goes when the drawer closes because the viewport reached the inline threshold. Default: the Navigation Bar item matching the last open group, else the bar’s first item. The docs layout passes the in-flow sidebar’s current link. |
logo | | The logo repeated in the drawer’s bar. Default: the Navigation Bar’s. |
logoHref | | The logo link. Default: the Navigation Bar’s, else “/". |
logoLabel | | The logo link’s accessible name. Default: the Navigation Bar’s. |
morph | | The outline morph (§9.17) [D206]: the menu Button’s ring (or its ink
box) grows into the sheet as it opens and shrinks back onto it as it
closes. Default |
nav | | A complete navigation shown in the Scroll Area in place of the drawer’s
own list: the docs layout’s |
navLabel | | The drawer |
primary | | Override the header scope’s primary. Never defaulted [D133]. |
renderLink | | Builds the logo link, e.g. |
secondary | | Override the header scope’s secondary. Never defaulted. |
sections | | The top-level rows from the shared navigation data (utils/navigation),
the object that also feeds |
triggerClassName | | Class names for the menu Button, added after its own. |
children | | The top-level rows: |
className | | Class names for the sheet, added after its own. |
NavDrawerGroup and NavDrawerLink
One top-level group: an independent Collapsible whose trigger row shows
the expand/collapse glyph [D109] (outward in --role-muted, inward in
--primary12 when open; it swaps, never rotates), over its child links on
an indent guide. A group holding the current page opens by default and
its row takes the start-edge bar (aria-current="true").
| Prop | Type | Description |
|---|---|---|
label | | The group row’s label, in the display serif ( |
children | | The group’s |
A drawer link. At the top level it is a direct link, styled as a group
row without the glyph (the bare-text underline on hover); in a group, a
type-body-ui child link on the indent guide; in the footer, a utility
link. Child and footer links are list links, whose hover is color only
[D181]. The current page takes aria-current="page", the --border-size-2–25
start-edge bar and weight 700.
| Prop | Type | Description |
|---|---|---|
active | | Marks the link as the current page. Default: its path equals the drawer’s |
NavDrawerFooter
The drawer’s fixed footer zone, under a --border-size-2 --role-rule: the
primary pill first (where the header’s action goes below 768 px), then
the utility links at a --fgd-size-hit pitch, then the locale Select. Put
it in the drawer’s footer.
| Prop | Type | Description |
|---|---|---|
action | | The primary pill: a |
locale | | The locale Select (or a locale link). |
children | | Utility links ( |
Additional types
NavDrawerFooterProps
NavDrawerGroupProps
NavDrawerLinkProps
NavDrawerProps
navigationDrawer
Specification: DESIGN-SYSTEM.md §11.6 (mobile navigation drawer) [D97, D183], with the Dialog of §10.14 and the disclosure glyph of §10.13 [D109].