logo

SINGULARITY

DOCS

PurchaseReturn to the Dashboard
Reference

App Bar

The App Bar presents information and actions relevant to the active screen.

The top App Bar offers content and actions tied to the current view. It serves purposes like branding, displaying screen titles, facilitating navigation, and providing action options.
It can adapt into a contextual action bar or function as a navigation bar.

Basic App bar

News

App bar with menu

Photos

App bar with responsive menu

LOGO
LOGO

App bar with search field

A sidebar-integrated search bar.
MUI

Responsive App bar with Drawer

App bar with a primary search field

A prominently featured search bar.
MUI

Dense (desktop only)

Photos

Prominent

An emphasized app bar design.
MUI

Bottom App bar

Fixed placement

When the app bar is set to a fixed position, its size does not affect the layout of the remaining page content. This may cause some content to be hidden behind the app bar. Here are three potential solutions:
  1. You can use position="sticky" instead of fixed.
  2. You can render a second <Toolbar /> component:
function App() {
  return (
    <React.Fragment>
      <AppBar position="fixed">
        <Toolbar>{/* content */}</Toolbar>
      </AppBar>
      <Toolbar />
    </React.Fragment>
  );
}
  1. You can use theme.mixins.toolbar CSS:
const Offset = styled('div')(({ theme }) => theme.mixins.toolbar);

function App() {
  return (
    <React.Fragment>
      <AppBar position="fixed">
        <Toolbar>{/* content */}</Toolbar>
      </AppBar>
      <Offset />
    </React.Fragment>
  );
}

Scrolling

The useScrollTrigger() hook enables dynamic responses to user scrolling actions.

Hide App bar

The app bar conceals itself when scrolling down to maximize space for content viewing.

Elevate App bar

The app bar elevates during scrolling to indicate that the user is not at the top of the page.

Back to top

A floating action button appears during scrolling to facilitate quick navigation back to the page's top.

useScrollTrigger([options]) => trigger

Arguments

  1. options (object [optional]):
    • options.disableHysteresis (bool [optional]): Defaults to false. Disables hysteresis, ignoring scroll direction when determining the trigger value.
    • options.target (Node [optional]): Defaults to window.
    • options.threshold (number [optional]): Defaults to 100. Adjusts the trigger value when the vertical scroll crosses this threshold (exclusive).

Returns

trigger: Indicates whether the scroll position meets the specified criteria.

Examples

import useScrollTrigger from '@mui/material/useScrollTrigger';

function HideOnScroll(props) {
  const trigger = useScrollTrigger();
  return (
    <Slide in={!trigger}>
      <div>Hello</div>
    </Slide>
  );
}

Enable color on dark

In accordance with Material Design guidelines, the color prop does not alter the app bar's appearance in dark mode. You can override this by setting the enableColorOnDark prop to true.
enableColorOnDark
default