Skip to main content brightness_auto motion_photos_off palette download more_vert
toc

Elevation

Elevation is the distance between two surfaces on the z-axis.

Elevation is the distance between two surfaces on the z-axis. It tells people which surface sits in front, which one sits behind, and which one is the current focus. Every surface and component has an elevation, so keep the number of levels small.

There are six levels, 0 to 5. Each one has a token:

  • --md-sys-elevation-shadow-0 (no shadow) to --md-sys-elevation-shadow-5

Levels 0 to 3 are for resting components. Levels 4 and 5 are for interaction states, such as hover and drag. Components raise by one level when hovered or focused: a FAB goes from level 3 to level 4, and a filled button goes from level 0 to level 1.

The tokens are defined in labs/gb/styles/elevation/md-elevation-tokens.scss. Shadow colors come from --md-sys-color-shadow, so they adapt to the color scheme.

Each component has a fixed resting level. Do not change it on your own.

Level Components
0 Buttons (filled, tonal, outlined), button group, split button, icon buttons, chips, segmented button, cards (filled, outlined), carousel, list, navigation rail, tabs, slider, app bar (not scrolled), full-screen dialog, docked side sheet
1 Elevated button, elevated card, elevated chip, modal navigation drawer, modal bottom sheet, modal side sheet
2 Menu, navigation bar, rich tooltip
3 FAB (small, standard and extended), FAB menu close button, modal dialog, date picker, time picker, floating toolbar, full-screen dialog above compact windows (where it is a basic dialog)

The search bar also rests at level 0 without a shadow, but it shows its level by tone (see below).

Showing elevation with tone

Link to “Showing elevation with tone”

Elevation can be shown with a tonal surface color instead of a shadow. Two components do this in gb:

  • Search bar: no shadow. Its container uses surface-container-high, the tone for level 3.
  • App bar when scrolled: no drop shadow. Its container changes from surface to surface-container, the tone for level 2, so it separates from the content under it.

Use tone when a surface only needs to be told apart from what is behind it.

Shadows are for two cases only: to protect an element on a busy or patterned background, and to encourage interaction, such as a card that lifts on hover. Otherwise rely on the tonal difference between surfaces, which is the default. A small, sharp shadow means the surface is close to the one behind it. A larger, softer shadow means more distance.

Pick up milk
HTMLCSS
<div class="note-card">Pick up milk</div>
  • Do not hard-code shadow values. Use the level tokens so a change to the scale reaches every surface.
  • Avoid changing the default elevation of a component. When an interaction such as hover changes it, make the change the same for every similar component.
  • Give floating elements enough contrast with the surface beneath them, either through the shadow or through a tone difference.
Install Material Web 3.0

Your browser did not offer to install the docs as an app. Install them from the browser instead:

Close
Send feedback
Bug Documentation Idea

Opens a new GitHub issue for material-components/material-web in a new tab, with this filled in.

Cancel Open issue