Configuring the Position

The AppBar enables you to specify its position in relation to the page content.

Position

To specify where the AppBar will be displayed, use the position property.

The AppBar provides the following options for setting its position:

  • top(Default)Positions the AppBar at the top of the content. Setting the position property to top requires adding the Appbar component before the page content. The position property applies CSS top: 0 style in fixed mode and also adds a box-shadow to the bottom of the AppBar.
  • bottomPositions the AppBar at the bottom of the content. Setting the position property to bottom requires adding the Appbar component after the page content. The position property applies CSS bottom: 0 style in fixed mode and also adds a box-shadow to the top of the AppBar.
Example
View Source
Edit In Stackblitz  
Change Theme:

Position Mode

To specify the type of positioning mode used for the AppBar, use the positionMode property.

The AppBar provides the following options for setting the position mode:

  • static(Default)Does not position the AppBar in any special way. It is positioned according to the normal flow of the page.
  • stickyPositions the AppBar based on the user's scroll position. A sticky element toggles between static and fixed CSS position property, depending on the scroll position.
  • fixedPositions the AppBar relative to the viewport. It always stays in the same place even if the page is scrolled.

When you render the AppBar with positionMode="fixed", the dimension of the element doesn't impact the rest of the page. This can cause parts of the content to be invisible, behind the AppBar. In this case either set padding of the page content or set sticky position mode.

Example
View Source
Edit In Stackblitz  
Change Theme:

In this article

Not finding the help you need?