Top App Bar

Material Design 3 top app bar web component (center-aligned, small, medium, large).

  • 1.8 KB gzipped
  • @lit-material/top-app-bar 0.0.4
  • Renders on the server

Example

Install

npm install @lit-material/top-app-bar @lit-material/tokens
import "@lit-material/top-app-bar";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-top-app-bar>

Material Design 3 top app bar.

Properties

PropertyAttributeTypeDefaultDescription
variantvariantTopAppBarVariant"small"
elevatedelevatedbooleanfalseWhether the bar shows its "scrolled" surface tint + shadow. Kept in sync automatically from scrollTarget (or window scroll by default), but can also be set directly if you're driving it from your own listener.
scrollTargetproperty onlyHTMLElement | undefinednoneElement whose scroll position drives elevated automatically. Defaults to window.
thresholdthresholdnumber4Scroll offset in pixels past which elevated turns on.

Slots

SlotDescription
defaultThe headline/title text.
leadingTypically a single navigation icon button.
trailingAction icon buttons, in order.

CSS parts

PartDescription
barThe header element (background/elevation).
leadingThe leading slot's container.
headlineThe headline slot's container.
trailingThe trailing slot's container.

Source on GitHub npm