# Elevation

Source: https://material.spynejs.com/foundations/elevation
Part of: Material shell gallery, Google's Material Design 3 for SpyneJS. Index: https://material.spynejs.com/llms.txt

Material's six elevation levels. A level is a height; the template works out the shadow for it when the app is built. A model does not choose elevation.

## In an app model

Nothing. Which level a thing stands at follows from what it is: a section’s surface is an elevated card, the app bar rises once the page has scrolled, a snackbar stands above the page.

## In a style

A level’s height is the custom property `--md-sys-elevation-level0` to `--md-sys-elevation-level5`. The height is not a shadow. The shadow for a level comes from a Sass function in the template’s token file, used where a style is written:

```scss
@use '../../00-spynejs-design-system/tokens/material';

.my-panel {
  box-shadow: material.elevation-shadow(2);
}
```

- The path in `@use` is from a file in `src/scss/03-components/material/`; from another folder it changes.
- The shadow’s colour is the role `--md-sys-color-shadow`. In the dark scheme a shadow shows much less; that is how Material has it.
- A card inside a section is outlined and casts no shadow, so that a card never casts a shadow onto a card.

## Where it is in the template

| File | What it holds | By name |
| --- | --- | --- |
| `src/scss/00-spynejs-design-system/tokens/_material.scss` | the levels, and the function that works out a level’s shadow | `elevation-shadow` |

The template is public: https://github.com/spynejs/application-shell-material. An app made from it has these same files.

## As the page shows it

The page’s own words, in its own order, read from the page as it is drawn in the light colour scheme. They were written for someone looking at the page: “above”, “below” and “marked” mean the drawn page. A thing the page draws is named here in its place (`Button:`, `Field:`, `Switch:`), and a box that reports what the reader does is as it starts, empty. What depends on the reader’s own window is left out.

How far a surface stands above the page. Material’s token for a level is only a height. The template works the shadow out from that height when it is built, by the same arithmetic as Google’s own elevation element.

### Levels

The value under each is the level’s height. In the dark scheme a shadow shows much less; that is how Material has it.

| Token | Custom property | Value |
| --- | --- | --- |
| level0 | `--md-sys-elevation-level0` | 0px |
| level1 | `--md-sys-elevation-level1` | 1px |
| level2 | `--md-sys-elevation-level2` | 3px |
| level3 | `--md-sys-elevation-level3` | 6px |
| level4 | `--md-sys-elevation-level4` | 8px |
| level5 | `--md-sys-elevation-level5` | 12px |
