Nav <pm-nav>
App sidebar navigation: a <nav> landmark with labelled groups, icons, badges, collapsible sub-menus and a collapsed icon rail.
Overview
auto-current marks the item whose href matches the current URL (and opens its parents). With native mobile on (mobile here or on an ancestor, or setMobile(true)), the same markup becomes a bottom tab bar on phones: top-level items, icons over labels, safe-area aware; parents open their sub-items in a sheet. mobile-variant="sidebar" keeps the sidebar and mobile-variant="none" hides it on phones.
A tab bar shows at most max-tabs tabs (default 5): with more top-level items, the last tab is "More" and opens the rest in a sheet. Inside <pm-app> the shell chooses the presentation (sidebar, icon rail, labelled rail, top row or tab bar) for the screen; set presentation yourself to use one of them anywhere.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
mobile | boolean | — | Native mobile patterns on phones (inherits from ancestors; mobile="false" opts out). |
label | string | — | Accessible name of the navigation landmark. |
collapsed | boolean | false | Show icons only (labels become tooltips and accessible names). |
auto-currentprop: autoCurrent | boolean | false | Mark the item matching location.pathname as current. |
mobile-variantprop: mobileVariant | 'bar' | 'sidebar' | 'none' | — | Phone layout when native mobile is on: bottom tab bar (default), sidebar, or none. |
presentation | 'list' | 'icons' | 'rail' | 'top' | 'bar' | — | Draw the nav this way whatever the screen (list, icons, rail, top, bar). Unset: sidebar, or the tab bar on native phones. |
max-tabsprop: maxTabs | number | — | Most tabs in the tab bar (default 5). With more top-level items the last tab is "More". |
more-labelprop: moreLabel | string | — | Label of the overflow tab (default "More"). |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Slots
| Slot | Description |
|---|---|
(default) | pm-nav-group and/or pm-nav-item elements. |
Methods
syncCurrent()
<pm-nav-group>
A labelled section of a pm-nav.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
label | string | — | Accessible name (and visible label where the component shows one). |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Slots
| Slot | Description |
|---|---|
(default) | pm-nav-item elements. |
<pm-nav-item>
Navigation link, or a collapsible parent when it contains pm-nav-item children.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
icon | string | — | Registered icon name (see registerIcons); an icon slot overrides it. |
href | string | — | Link target: renders a link instead of a button. |
label | string | — | Accessible name (and visible label where the component shows one). |
current | boolean | false | This item is the current page (aria-current="page"). |
expanded | boolean | false | Parent items: show children. Opens automatically when a child is current. |
disabled | boolean | false | Not interactive (and not submitted, for form controls). |
count | number | — | Count shown on the item (unread, pending); hidden at 0. |
max | number | — | Highest count shown before "+" (default 99). |
count-labelprop: countLabel | string | — | What the count means for screen readers; {count} is filled in (default: just the number). |
dot | boolean | false | Show a dot ("something new") instead of a number. |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-toggle | onPmToggle | A parent opened or closed. |
Slots
| Slot | Description |
|---|---|
icon | Leading icon. Set count for unread or pending items (a pill at the end; on the icon in the phone tab bar; a dot on the collapsed rail), with count-label saying what it means to screen readers ("{count} unread"). |
end | Trailing badge or content (the count pill comes first). |
(default) | Child pm-nav-item elements (makes this a collapsible parent). |
Methods
activate()
Used in templates
Overview dashboardTraffic analyticsOrdersCustomer 360InboxTeam chatAI assistantNotificationsProject boardTeam and rolesBilling and invoicesUser profileAccount settings