Material Design Lite
Banner
Bottom sheet
Date picker
Expansion Panel
Image list
Grid list
Menu
Ripple
Select
Stepper
Sort header
Tree
View on Material.io

Preview

Title Large
Title Large
Headline Small
Headline Medium

Installation

To import just the component styles, copy the following into your project’s styles.css file:

/* Core Styles */
@import url('https://kherrick.github.io/material-design-lite/css/core.css');
/* Material Icons */
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
/* Roboto Font */
@import url('https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap');
/* Component Styles */
@import url('https://kherrick.github.io/material-design-lite/css/components/list/style.css');
@import url('https://kherrick.github.io/material-design-lite/css/components/top-app-bar/style.css');

Usage

Start with a header element and add the top-app-bar class name:

<header class="top-app-bar">
   <span class="title">Title</span>
</header>

The top-app-bar class name is implicit when using the header element.

Scrollable

Add the scrolled class name to the top-app-bar to make it have a scrollable effect.

Title
<header class="top-app-bar scrolled">
  <span class="title">Title</span>
</header>
const header = document.querySelector(".top-app-bar");
window.addEventListener("scroll", (e) => {
  if (window.scrollY > 0) {
    header.classList.add("scrolled");
  } else {
    header.classList.remove("scrolled");
  }
});

Variants

Default

Default top app bar styling.

Title Large
<header class="top-app-bar center-aligned">
  <button class="icon-button leading">
    <i class="material-icons">menu</i>
  </button>
  <span class="title">Title Large</span>
  <div class="actions">
    <button class="icon-button">
      <i class="material-icons">search</i>
    </button>
  </div>
</header>

Small

Small top app bar styling.

Title Large
<header class="top-app-bar small">
  <button class="icon-button leading">
    <i class="material-icons">arrow_back</i>
  </button>
  <span class="title">Title Large</span>
  <div class="actions">
    <button class="icon-button">
      <i class="material-icons">info</i>
    </button>
    <button class="icon-button">
      <i class="material-icons">filter_list</i>
    </button>
    <button class="icon-button">
      <i class="material-icons">settings</i>
    </button>
  </div>
</header>

Medium

Medium top app bar styling.

Headline Small
<header class="top-app-bar medium">
  <button class="icon-button leading">
    <i class="material-icons">arrow_back</i>
  </button>
  <span class="title">Headline Small</span>
  <div class="actions">
    <button class="icon-button">
      <i class="material-icons">info</i>
    </button>
    <button class="icon-button">
      <i class="material-icons">filter_list</i>
    </button>
    <button class="icon-button">
      <i class="material-icons">settings</i>
    </button>
  </div>
</header>

Large

Large top app bar styling.

Headline Medium
<header class="top-app-bar large">
  <button class="icon-button leading">
    <i class="material-icons">arrow_back</i>
  </button>
  <span class="title">Headline Medium</span>
  <div class="actions">
    <button class="icon-button">
      <i class="material-icons">info</i>
    </button>
    <button class="icon-button">
      <i class="material-icons">filter_list</i>
    </button>
    <button class="icon-button">
      <i class="material-icons">settings</i>
    </button>
  </div>
</header>

Design Tokens

TokenDescriptionDefault
--md-comp-top-app-bar-paddingThe padding of the container16px
--md-sys-comp-top-app-bar-background-colorThe background color of the container
--md-sys-comp-top-app-bar-colorThe foreground color of the container

Resources

Playground

See the Pen Top App Bar by Rody Davis (@kherrick ) on CodePen.