App bar
App bars are placed at the top of the screen to help people navigate through a product.
Explore Banff
Trails, gondolas and wildlifeLake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
App bars are placed at the top of the screen to help people navigate through a product. They show information about the page, key actions, and navigation actions like Back or Menu. An app bar typically holds:
- A leading button, such as a menu icon or a back arrow
- A headline that describes the current page, the current section or the product
- One or two essential actions
To display more page actions, use a toolbar.
import { AppBar, Icon, IconButton } from '@material-web/react'
import { Button, Heading, Text } from 'react-aria-components'Basic app bar
Write the parts of the bar as its children, and give each a slot. See Slots.
Explore Banff
Hiking trails, gondolas, wildlife, and moreLake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
Lake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
Lake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
Lake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
Lake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
Lake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
Lake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
Lake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
Lake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
Lake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
Lake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
Lake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up Sulphur Mountain runs year round.
import { AppBar, Icon, IconButton } from '@material-web/react'
import { Heading, Text } from 'react-aria-components'
const paragraphs = Array.from({ length: 12 }, (_, index) => (
<p key={index} className="m-0 px-space-200 py-space-100 text-body-lg">
Lake Louise, Moraine Lake and the Icefields Parkway are a day trip from town, and the gondola up
Sulphur Mountain runs year round.
</p>
))
export default function Basic() {
return (
<div className="h-96 w-full overflow-y-auto">
<AppBar variant="medium-flexible" scrollBehavior="exit-until-collapsed">
<IconButton slot="leading" aria-label="Back">
<Icon name="arrow_back" />
</IconButton>
<Heading slot="headline" level={2}>
Explore Banff
</Heading>
<Text slot="subtitle">Hiking trails, gondolas, wildlife, and more</Text>
<IconButton slot="trailing" variant="tonal" aria-label="Share">
<Icon name="share" />
</IconButton>
</AppBar>
{paragraphs}
</div>
)
}The AppBar comes in three variants. Set variant to small (the default), medium-flexible or large-flexible.
Small app bar
Use a small app bar in dense layouts, or when a page is scrolled. A small bar is one 64dp row, with its text between the leading and trailing elements and the headline on one line.
Hiking trips with Elie in Santa Monica and Joshua Tree
import { AppBar, Icon, IconButton } from '@material-web/react'
import { Heading } from 'react-aria-components'
export default function Small() {
return (
<AppBar>
<IconButton slot="leading" aria-label="Back">
<Icon name="arrow_back" />
</IconButton>
<Heading slot="headline" level={2}>
Hiking trips with Elie in Santa Monica and Joshua Tree
</Heading>
<IconButton slot="trailing" aria-label="Map">
<Icon name="map" />
</IconButton>
<IconButton slot="trailing" aria-label="More options">
<Icon name="more_vert" />
</IconButton>
</AppBar>
)
}Medium flexible app bar
Use a medium flexible app bar to display a larger headline. A flexible bar shows its text under the row, in a larger type style. The headline wraps to two lines at most, and the bar is as tall as its text.
Hiking trips with Elie in Santa Monica and Joshua Tree
import { AppBar, Icon, IconButton } from '@material-web/react'
import { Heading } from 'react-aria-components'
export default function MediumFlexible() {
return (
<AppBar variant="medium-flexible">
<IconButton slot="leading" aria-label="Back">
<Icon name="arrow_back" />
</IconButton>
<Heading slot="headline" level={2}>
Hiking trips with Elie in Santa Monica and Joshua Tree
</Heading>
<IconButton slot="trailing" aria-label="Map">
<Icon name="map" />
</IconButton>
<IconButton slot="trailing" aria-label="More options">
<Icon name="more_vert" />
</IconButton>
</AppBar>
)
}Large flexible app bar
Use a large flexible app bar to emphasize the headline of the page. It lays out its text as a medium flexible bar does, in a type style larger still.
Hiking trips with Elie in Santa Monica and Joshua Tree
import { AppBar, Icon, IconButton } from '@material-web/react'
import { Heading } from 'react-aria-components'
export default function LargeFlexible() {
return (
<AppBar variant="large-flexible">
<IconButton slot="leading" aria-label="Back">
<Icon name="arrow_back" />
</IconButton>
<Heading slot="headline" level={2}>
Hiking trips with Elie in Santa Monica and Joshua Tree
</Heading>
<IconButton slot="trailing" aria-label="Map">
<Icon name="map" />
</IconButton>
<IconButton slot="trailing" aria-label="More options">
<Icon name="more_vert" />
</IconButton>
</AppBar>
)
}A flexible bar can collapse into a small app bar as the page scrolls. See Collapse app bar.
Slots
- leading
- headline
- subtitle
- search
- trailing
| Slot | Child | Use |
|---|---|---|
leading | One element: an IconButton, a Button, a Link, an Icon or an element of your own | The start of the row |
headline | A Heading | In the row of a small bar, under the row of a flexible bar |
subtitle | A Text | Under the headline |
search | A Button or a Link, in place of the headline | In the row, between the leading and trailing elements |
trailing | Up to three elements, of the same kinds | The end of the row |
- Checked slots: A
Heading,Text,Button,LinkorIconwith a slot the bar does not have throws anInvalid sloterror. AHeadingor aTextwith no slot throws an error too. - Your own elements: An element of your own is placed by its
slotattribute, which is not checked. Always give it one: without a slot, it is placed under the row.
Import Heading, Text, Button and Link from react-aria-components. See Slots.
Headline and subtitle
Put a Heading in the headline slot and a Text in the subtitle slot. The subtitle is shown under the headline. Keep the headline brief enough to fit in the bar, and use the subtitle to add context to the page.
Recap from June 12-19
8 photosRecap from June 12-19
8 photosRecap from June 12-19
8 photosimport { AppBar, Icon, IconButton } from '@material-web/react'
import { Heading, Text } from 'react-aria-components'
export default function HeadlineAndSubtitle() {
return (
<div className="flex flex-col gap-space-300">
<AppBar>
<IconButton slot="leading" aria-label="Back">
<Icon name="arrow_back" />
</IconButton>
<Heading slot="headline" level={2}>
Recap from June 12-19
</Heading>
<Text slot="subtitle">8 photos</Text>
<IconButton slot="trailing" aria-label="Favorite">
<Icon name="favorite" />
</IconButton>
</AppBar>
<AppBar className="text-center">
<IconButton slot="leading" aria-label="Back">
<Icon name="arrow_back" />
</IconButton>
<Heading slot="headline" level={2}>
Recap from June 12-19
</Heading>
<Text slot="subtitle">8 photos</Text>
<IconButton slot="trailing" aria-label="Favorite">
<Icon name="favorite" />
</IconButton>
</AppBar>
<AppBar variant="large-flexible" className="text-center">
<IconButton slot="leading" aria-label="Back">
<Icon name="arrow_back" />
</IconButton>
<Heading slot="headline" level={2}>
Recap from June 12-19
</Heading>
<Text slot="subtitle">8 photos</Text>
<IconButton slot="trailing" aria-label="Favorite">
<Icon name="favorite" />
</IconButton>
</AppBar>
</div>
)
}- Heading level: The headline is a level 1 heading. To change that, set
levelon theHeading. - Alignment: The text starts at the leading edge. Set
className="text-center"on the bar to center it. - Image: To show an image or a logo in place of the headline text, put it inside the
Headingand give it analt, which names the headline.
Leading and trailing elements
Give one element the leading slot, and up to three elements the trailing slot: an IconButton, an Icon, or an element of your own, such as an avatar. An Icon in either slot is sized by the bar.
Inbox
Inbox
ANew message
import { AppBar, Icon, IconButton } from '@material-web/react'
import { Heading } from 'react-aria-components'
export default function LeadingAndTrailing() {
return (
<div className="flex flex-col gap-space-300">
<AppBar>
<Heading slot="headline" level={2}>
Inbox
</Heading>
<IconButton slot="trailing" aria-label="Search">
<Icon name="search" />
</IconButton>
</AppBar>
<AppBar>
<IconButton slot="leading" aria-label="Menu">
<Icon name="menu" />
</IconButton>
<Heading slot="headline" level={2}>
Inbox
</Heading>
<IconButton slot="trailing" aria-label="Search">
<Icon name="search" />
</IconButton>
<IconButton slot="trailing" aria-label="Today">
<Icon name="event" />
</IconButton>
<span
slot="trailing"
role="img"
aria-label="Account"
className="grid size-8 place-items-center rounded-full bg-primary text-title-md text-on-primary"
>
A
</span>
</AppBar>
<AppBar>
<IconButton slot="leading" aria-label="Back">
<Icon name="arrow_back" />
</IconButton>
<Heading slot="headline" level={2}>
New message
</Heading>
<IconButton slot="trailing" variant="filled" aria-label="Send">
<Icon name="send" className="icon-filled" />
</IconButton>
</AppBar>
</div>
)
}- Leading button: Use the leading button for navigating the product. It is typically a menu icon, or a back arrow that returns to the previous screen.
- Trailing buttons: Place the most used actions closest to the leading edge.
- Filled and tonal buttons: If you change a trailing icon button to the
filledortonalvariant, use only one icon button.
Placement
The bar stays at the top of its nearest scrolling ancestor, or of the page, above the content. It keeps its own room in the layout, so the content starts under it and needs no offset.
Write the bar inside the element that scrolls, before the content. With no scrolling ancestor, the bar follows the scroll of the page.
Top stories
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
import { AppBar, Icon, IconButton } from '@material-web/react'
import { Heading } from 'react-aria-components'
const paragraphs = Array.from({ length: 12 }, (_, index) => (
<p key={index} className="m-0 px-space-200 py-space-100 text-body-lg">
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it
looks absolutely incredible from what I can see.
</p>
))
export default function Pinned() {
return (
<div className="h-80 overflow-y-auto">
<AppBar>
<IconButton slot="leading" aria-label="Back">
<Icon name="arrow_back" />
</IconButton>
<Heading slot="headline" level={2}>
Top stories
</Heading>
<IconButton slot="trailing" aria-label="More options">
<Icon name="more_vert" />
</IconButton>
</AppBar>
{paragraphs}
</div>
)
}Scrolling
Set scrollBehavior to choose what the bar does as the content scrolls:
scrollBehavior | As the content scrolls |
|---|---|
pinned (the default) | The bar stays in place. |
enter-always | The bar collapses as the content scrolls down, and expands as soon as the content scrolls back up, anywhere in the page. |
exit-until-collapsed | The bar collapses the same way, and expands only when the content is scrolled all the way back to the top. |
When a scroll stops with the bar part way collapsed, the bar settles on the nearer end and scrolls the content with it.
Hide app bar
A small bar collapses completely, which leaves the whole screen to the content.
Aki Aro
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
import { AppBar, Icon, IconButton } from '@material-web/react'
import { Heading } from 'react-aria-components'
const paragraphs = Array.from({ length: 12 }, (_, index) => (
<p key={index} className="m-0 px-space-200 py-space-100 text-body-lg">
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it
looks absolutely incredible from what I can see.
</p>
))
export default function EnterAlways() {
return (
<div className="h-80 overflow-y-auto">
<AppBar scrollBehavior="enter-always">
<IconButton slot="leading" aria-label="Back">
<Icon name="arrow_back" />
</IconButton>
<Heading slot="headline" level={2}>
Aki Aro
</Heading>
<IconButton slot="trailing" aria-label="More options">
<Icon name="more_vert" />
</IconButton>
</AppBar>
{paragraphs}
</div>
)
}Collapse app bar
A flexible bar collapses into a small app bar, with its headline and subtitle in the row. The row shows a copy of their content, without its event handlers, so keep links and buttons out of a headline that collapses. Use exit-until-collapsed to keep it small until the page is scrolled back to the top.
Recap from June 12-19
8 photosHey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it looks absolutely incredible from what I can see.
import { AppBar, Icon, IconButton } from '@material-web/react'
import { Heading, Text } from 'react-aria-components'
const paragraphs = Array.from({ length: 12 }, (_, index) => (
<p key={index} className="m-0 px-space-200 py-space-100 text-body-lg">
Hey! I’ve got pics and more info on our cabin for the weekend. Get ready to be impressed: it
looks absolutely incredible from what I can see.
</p>
))
export default function ExitUntilCollapsed() {
return (
<div className="h-96 overflow-y-auto">
<AppBar variant="large-flexible" scrollBehavior="exit-until-collapsed">
<IconButton slot="leading" aria-label="Back">
<Icon name="arrow_back" />
</IconButton>
<Heading slot="headline" level={2}>
Recap from June 12-19
</Heading>
<Text slot="subtitle">8 photos</Text>
<IconButton slot="trailing" aria-label="Search">
<Icon name="search" />
</IconButton>
<IconButton slot="trailing" aria-label="Favorite">
<Icon name="favorite" />
</IconButton>
</AppBar>
{paragraphs}
</div>
)
}Fill on scroll
Once the content has scrolled under it, the bar and its search bar change to a contrasting fill color, which separates them from the content. Scroll the pinned bar above to see it.
Set isScrolled to control the fill yourself.
Flat
On scroll
import { AppBar, Icon, IconButton } from '@material-web/react'
import { Button, Heading } from 'react-aria-components'
export default function OnScroll() {
return (
<div className="flex flex-col gap-space-300">
{[false, true].map((isScrolled) => (
<AppBar key={String(isScrolled)} isScrolled={isScrolled}>
<IconButton slot="leading" aria-label="Back">
<Icon name="arrow_back" />
</IconButton>
<Heading slot="headline" level={2}>
{isScrolled ? 'On scroll' : 'Flat'}
</Heading>
<IconButton slot="trailing" aria-label="Search">
<Icon name="search" />
</IconButton>
</AppBar>
))}
<AppBar isScrolled className="text-center">
<IconButton slot="leading" aria-label="Menu">
<Icon name="menu" />
</IconButton>
<Button slot="search">Search product</Button>
</AppBar>
</div>
)
}App bar with menu
To open a menu from the bar, wrap a trailing IconButton and its MenuPopover in a MenuTrigger. The button keeps its slot.
Photos
import { AppBar, Icon, IconButton, Menu, MenuItem, MenuPopover } from '@material-web/react'
import { Heading, MenuTrigger } from 'react-aria-components'
export default function AppBarWithMenu() {
return (
<AppBar>
<IconButton slot="leading" aria-label="Menu">
<Icon name="menu" />
</IconButton>
<Heading slot="headline" level={2}>
Photos
</Heading>
<MenuTrigger>
<IconButton slot="trailing" aria-label="Account">
<Icon name="account_circle" />
</IconButton>
<MenuPopover>
<Menu>
<MenuItem>Profile</MenuItem>
<MenuItem>My account</MenuItem>
<MenuItem>Sign out</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</AppBar>
)
}Note: Avoid a trailing button that opens a menu with more actions. If the page needs more actions, place them in a toolbar instead.
Search app bar
Use a search app bar on home pages when search is key to the product. Put a Button in the search slot in place of the headline, and open your search view in its onPress. The slot also takes a Link with an href.
Write the hinted search text as its children, with an Icon in its leading or trailing slot to show an icon before or after the text. The search bar sizes itself to the space between the leading and trailing elements.
import { AppBar, Icon, IconButton } from '@material-web/react'
import { Button } from 'react-aria-components'
export default function SearchAppBar() {
return (
<AppBar className="text-center">
<IconButton slot="leading" aria-label="Menu">
<Icon name="menu" />
</IconButton>
<Button slot="search">
<Icon slot="leading" name="search" />
Search product
<Icon slot="trailing" name="mic" className="icon-filled" />
</Button>
<span
slot="trailing"
role="img"
aria-label="Account"
className="grid size-8 place-items-center rounded-full bg-primary text-title-md text-on-primary"
>
A
</span>
</AppBar>
)
}Note: Leave variant at small for a search app bar.
Customization
Pass classes in className to restyle one bar. They go on its <header> element, with style and the rest of the props. See Styling for the classes and the theme.
- States: To style the bar by its state, target its
data-scrolledanddata-collapsedattributes. A bar hasdata-scrolledwhile it shows its fill on scroll, and a flexible bar hasdata-collapsedwhile it is collapsed into a small app bar. - Functions: The children of the search bar can be a function of its state. The children of the
AppBarcannot. See Children as a function. - Every app bar: To restyle all the app bars at once, change the theme.
Use cases
Material lists what people should be able to do with assistive technology:
- Understand what page they're currently visiting
- Take actions or navigate to a new page destination
- Maintain access to app bar actions when the content is scrolled
Interaction and style
- States: The search bar and the icon buttons show a state layer on hover and a ripple on a press. Keyboard focus shows a focus ring, and a press with a mouse or touch does not.
- Color contrast: The search bar uses the default color roles, which Material advises keeping where possible: surface container for its container, and on surface variant for its text. If you change them, keep 3:1 contrast between its text and its container.
- Forced colors: The search bar keeps an edge in forced colors.
- Right to left: The layout is mirrored in a right-to-left direction.
Focus
- The bar is not a tab stop. Tab moves the focus through the controls in it, in the order written.
- Write the leading element first, so that the focus lands on the leading button first, as Material advises.
Keyboard navigation
| Keys | Actions |
|---|---|
| Tab | Move the focus to the next control |
| Space or Enter | Activate the focused control |
Labeling elements
- The headline is a level 1 heading, unless the
Headingsets anotherlevel. Its text names it. Material advises adding context where needed, so that people understand what page they are on: set anaria-labelon theHeadingthat includes its text. - Give an image headline an
alt, which names the headline. - The search bar is named by its hinted text.
- An
IconButtonhas no visible label, so give each anaria-labelthat names the action it takes, such as View on map. See Icon button.
variant'small' | 'medium-flexible' | 'large-flexible'Default'small'Four variants: Search app bar, small, medium flexible, large flexible
small: Use in dense layouts or when a page is scrolled.medium-flexible: Use to display a larger headline. It can collapse into a small app bar on scroll.large-flexible: Use to emphasize the headline of the page.
Search app bar: Use on home pages when search is key to the product.
scrollBehavior'pinned' | 'enter-always' | 'exit-until-collapsed'Default'pinned'The app bar can remain on a page at all times, or can hide and reappear when scrolling.
Upon scrolling, an app bar container fills with contrasting color to create a visual separation
Medium and large flexible app bars can use the compress effect to transform into small app bars when scrolled
When scrolled, medium flexible and large flexible app bars can transform into small app bars. They should remain small until the page is scrolled back to the top. Don’t transform app bars into a search app bar.
enter-always: When the user pulls up the scaffold's inner content, the top app bar collapses. The app bar expands when the user starts pulling down the inner content.exit-until-collapsed: Similar toenterAlwaysScrollBehavior, though the app bar only expands when the user pulls the content all the way down.pinned: The app bar remains in place and does not react to scrolling.
isScrolledbooleanAll app bars share the same color roles. On scroll, the container changes color to surface container.
App bars should initially be the same color as the background, then fill with a contrasting color on scroll to provide visual separation from the background.
The app bar changes color when flat or on scroll. The search bar can also change color on scroll.
Props of AppBar (1)
refRef<HTMLElement>Allows getting a ref to the component instance. Once the component unmounts, React will set
ref.currenttonull(or call the ref withnullif you passed a callback ref).
AppBar also takes the 278 attributes and events of the element it renders.