Elevation
Surfaces above the canvas
Elevation shows how far a surface sits above the canvas. Each level is shown by a shadow.
Elevation runs from elevation-0, which sits on the canvas and has no shadow, to elevation-6.
Use
The components set their own elevation. A card is at elevation-1, for example, and a modal at elevation-5.
For a surface of your own, use an elevation class, from .elevation-0 to .elevation-6. Each class sets the box shadow from its token:
<div class="panel elevation-2">…</div>.panel {
padding: var(--spacing-4);
background: var(--color-surface);
}The elevation classes are in the theme package's CSS, so they work without Tailwind. In a Tailwind app, use the elevation class, not Tailwind's shadow-* utilities. The preset keeps those, but a shadow size doesn't say which level a surface is at.
How it works
The stack
An interface is a stack. The canvas is at the base, and surfaces sit above it at elevation steps 1 to 6. Text, labels, borders and interactive elements sit on a surface.
The levels
Each step above elevation-0 raises a surface further, with a larger and softer shadow:
<div class="elevation-0">…</div>
<div class="elevation-1">…</div>
…
<div class="elevation-6">…</div>0123456The components use these levels:
| Level | Components |
|---|---|
elevation-1 | Card, Callout and MapPointSearch |
elevation-2 | Map controls, the chart tooltip, MultipleActionButton, ThemeSwitcher and FileUpload |
elevation-3 | The Select drop-down list |
elevation-4 | Tooltip, Popover, Toast, the geocoder's suggestion list, LoginForm and the map marker container |
elevation-5 | Modal |
elevation-6 | Not used |
A card sets its own elevation, border and padding:
<Card title="Population">…</Card>Placeholder content
Colour and elevation
A surface uses --color-surface, or --color-surface-muted to set it apart from what is around it. Its elevation step sets how far it sits above the canvas.
Elevation and z-index
Elevation sets the shadow only. Stacking order is set by z-index.
Shadow tokens
The shadow tokens, --shadow-sm to --shadow-2xl, are still published. Use an elevation step for a surface. --elevation-1 to --elevation-6 have the same values as --shadow-sm, --shadow, --shadow-md, --shadow-lg, --shadow-xl and --shadow-2xl. --shadow-inner has no elevation step.
Reference
Elevation
| Token | Value | Example |
|---|---|---|
--elevation-0 | 0px 0px 0px 0px #00000000 | |
--elevation-1 | 0px 1px 2px 0px #0000000d | |
--elevation-2 | 0px 1px 3px 0px #0000001a, 0px 1px 2px -1px #0000001a | |
--elevation-3 | 0px 2px 4px -2px #0000001a, 0px 4px 6px -1px #0000001a | |
--elevation-4 | 0px 4px 6px -4px #0000001a, 0px 10px 15px -3px #0000001a | |
--elevation-5 | 0px 8px 10px -6px #0000001a, 0px 20px 25px -5px #0000001a | |
--elevation-6 | 0px 25px 50px -12px #00000040 |
Shadow
| Token | Value | Example |
|---|---|---|
--shadow | 0px 1px 3px 0px #0000001a, 0px 1px 2px -1px #0000001a | |
--shadow-inner | inset 0px 2px 4px 0px #0000000d | |
--shadow-sm | 0px 1px 2px 0px #0000000d | |
--shadow-md | 0px 2px 4px -2px #0000001a, 0px 4px 6px -1px #0000001a | |
--shadow-lg | 0px 4px 6px -4px #0000001a, 0px 10px 15px -3px #0000001a | |
--shadow-xl | 0px 8px 10px -6px #0000001a, 0px 20px 25px -5px #0000001a | |
--shadow-2xl | 0px 25px 50px -12px #00000040 |
The full rules for elevation are in the specification.