London City Data

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.

TextTokencanvassurfacesurface-mutedtextlabelborderinteractiveElevationelevation-1 to 6elevation-0Button

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>
0
1
2
3
4
5
6

The components use these levels:

LevelComponents
elevation-1Card, Callout and MapPointSearch
elevation-2Map controls, the chart tooltip, MultipleActionButton, ThemeSwitcher and FileUpload
elevation-3The Select drop-down list
elevation-4Tooltip, Popover, Toast, the geocoder's suggestion list, LoginForm and the map marker container
elevation-5Modal
elevation-6Not used

A card sets its own elevation, border and padding:

<Card title="Population">…</Card>
Population

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

TokenValueExample
--elevation-00px 0px 0px 0px #00000000
--elevation-10px 1px 2px 0px #0000000d
--elevation-20px 1px 3px 0px #0000001a, 0px 1px 2px -1px #0000001a
--elevation-30px 2px 4px -2px #0000001a, 0px 4px 6px -1px #0000001a
--elevation-40px 4px 6px -4px #0000001a, 0px 10px 15px -3px #0000001a
--elevation-50px 8px 10px -6px #0000001a, 0px 20px 25px -5px #0000001a
--elevation-60px 25px 50px -12px #00000040

Shadow

TokenValueExample
--shadow0px 1px 3px 0px #0000001a, 0px 1px 2px -1px #0000001a
--shadow-innerinset 0px 2px 4px 0px #0000000d
--shadow-sm0px 1px 2px 0px #0000000d
--shadow-md0px 2px 4px -2px #0000001a, 0px 4px 6px -1px #0000001a
--shadow-lg0px 4px 6px -4px #0000001a, 0px 10px 15px -3px #0000001a
--shadow-xl0px 8px 10px -6px #0000001a, 0px 20px 25px -5px #0000001a
--shadow-2xl0px 25px 50px -12px #00000040

The full rules for elevation are in the specification.