Basic Top App Bar

This is a simple top app bar with:

  • A leading back navigation button
  • A page title
  • Trailing action buttons (search and more)

Content area below the top app bar

The small top app bar is the standard top app bar for most use cases. It has a default height of 64dp and includes:

  • Leading navigation icon: Usually a back or menu button, depending on screen context
  • Title: Showing the current screen name or app title
  • Trailing actions: Common actions for the current screen

The top app bar remains visible as users scroll, providing consistent access to navigation and actions.

Top App Bar Types

Center-Aligned Type

Used for the main root page in an app. Displays the app name or page headline centered in the bar.

Small Type

Used for sub-pages that require back navigation and multiple actions. Default height is 64dp.

Medium Type

Used for a larger headline treatment. Default height is 112dp with the headline in the bottom section.

Large Type

Used to emphasize the headline of the page. Default height is 152dp with a more prominent headline.

Material Design offers four types of top app bars to match different UX needs:

  • Center-aligned: For root pages, with the title centered in the bar
  • Small: For compact layouts or sub-pages requiring back navigation
  • Medium: For initial states that highlight the screen title (112dp height)
  • Large: For maximum headline emphasis with a 152dp height

The type can be selected based on information hierarchy needs, with medium and large variants creating more visual space between content sections.

Scroll Behavior

Color Change on Scroll

Scroll down to see the behavior.

This demonstrates the standard scroll behavior of the top app bar.

As you scroll down, the app bar will change its background color.

Scroll back to the top to see the app bar return to its original state.

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

You've reached the bottom! Try scrolling back up.

Status: At Top

Compress Effect

Scroll down to see the behavior.

This demonstrates the compress scroll behavior of the top app bar.

As you scroll down, the medium app bar will compress to a small app bar.

Scroll back to the top to see the app bar return to its original state.

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

You've reached the bottom! Try scrolling back up.

Status: At Top

Top app bars have two key scroll behaviors:

  • Color change: The top app bar fills with a surface container color to create visual separation from content when scrolling.
  • Compress effect: Medium and large app bars can compress to the small size when scrolling down, optimizing screen space.

These behaviors help maintain context while maximizing content area. The app bar returns to its original state when scrolled back to the top.

Responsive Behavior

100%
Current simulated width: 100%

As the screen width decreases:

  • Actions are consolidated into the overflow menu
  • The title may be shortened to fit the available space

Visible Actions

Search
Favorite
Share
More

Overflow Menu

No actions in overflow menu

Custom Actions & Context

Browse Mode

The top app bar displays browsing actions like Search, Filter, and View options.

This mode is useful for content exploration and discovery.

Events & API Methods

This is a scrollable area to test scroll events.

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

Scroll content...

The Top App Bar provides several API methods and events:

  • Title Management: Use setTitle() and getTitle() to update or retrieve the current title.
  • Scroll Events: Listen for scroll events to respond to scrolling behavior.
  • Type Switching: Use setType() to change between small, medium, large, or center-aligned variants.
  • Element Access: Methods like getHeadlineElement(), getLeadingContainer(), and getTrailingContainer() provide access to key elements.

Try scrolling in the demo area above or using the control buttons to see the events and API methods in action.