AppBar <pm-app-bar>
App bar: the sticky bar above a page, with the menu button, a back button, the page title, search and actions.
Overview
In native mode on phones and tablets it behaves like an app's navigation bar: the page's own <h1> is the large title, and its text fades into the bar once the heading has scrolled away; back shows a back button; the search field moves to its own row. On the web and on desktops it is a plain toolbar row.
Works inside <pm-app> (its menu button then opens the drawer or folds the sidebar) and on its own.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
heading | string | — | Title text. Default: the text of the page's <h1>. |
back | string | — | Show a back button. With a URL it is a link; empty, it goes back in history. |
show-backprop: showBack | 'native' | 'always' | — | When the back button shows: on touch layouts in native mode (native, default) or always. |
nav-toggleprop: navToggle | boolean | false | Show the menu button where the shell has something to open or fold. |
title-modeprop: titleMode | 'auto' | 'inline' | 'large' | 'none' | — | auto (default): in native mode on touch layouts the title appears when the page heading scrolls away;
elsewhere the bar has no title unless heading is set. inline: always shown. large: always the collapsing
behaviour. none: never. |
menu-labelprop: menuLabel | string | — | Accessible name of the menu button (default "Menu"). |
back-labelprop: backLabel | string | — | Accessible name of the back button (default "Back"). |
mobile | boolean | — | Native app patterns on touch devices (inherits from ancestors; mobile="false" opts out). |
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-back | onPmBack | The back button was used. Cancel it to handle navigation yourself. |
pm-nav-toggle | onPmNavToggle | The menu button was used outside a pm-app (inside one, the shell fires it). |
Slots
| Slot | Description |
|---|---|
start | After the menu and back buttons (a workspace switcher, a logo). |
(default) | Next to the title (tabs, a status). |
search | A search field. |
end | Actions at the end (notifications, account menu). |
CSS parts
| Part | Description |
|---|---|
::part(base) | The bar. |
::part(title) | The title in the bar. |
::part(nav-toggle) | The menu button. |
::part(back) | The back button. |
Used in templates
Overview dashboardTraffic analyticsOrdersCustomer 360InboxTeam chatAI assistantNotificationsProject boardTeam and rolesBilling and invoicesUser profileAccount settings