Elevation

Shadow tokens that express the distance between surfaces.

Overview

Wave provides a set of elevation values to maintain standardised surface hierarchy between components. Elevation tokens are sets of shadow values that express z-axis distance between surfaces, giving the illusion of elevation. The effect of the elevation is defined by the intensity and depth of the shadow.

Elevation tokens#

Token
Value
Preview
Examples
elevationXs
0 1px 2.5px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 8%), transparent), 0 3px 9px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 4.8%), transparent)
Cards, selects, buttons
elevationS
0 0.4px 2.2px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 2.2%), transparent), 0 1.4px 5px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 4%), transparent), 0 5px 14px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 6%), transparent)
Tooltips, toasts
elevationM
0 0.3px 2px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 1.5%), transparent), 0 1.5px 8px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 2.4%), transparent), 0 4px 16px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 4%), transparent), 0 8px 24px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 7%), transparent)
Dropdowns, popovers, menus, drawers, floating buttons
elevationL
0 0.7px 2px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 1.5%), transparent), 0 1.6px 8px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 2.4%), transparent), 0 3.3px 16px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 3.4%), transparent), 0 5px 26px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 6%), transparent), 0 12px 42px color-mix(in oklab, var(--shadow-color, hsl(166, 48%, 7%)) calc(var(--shadow-intensity, 1) * 8%), transparent)
Panels, modal dialogs

Usage#

Customising elevation#

When using shadows on a coloured background, coloured shadows can often look more natural than the default grey-based shadows, which tend to appear washed-out.

  • ​
    --shadow-color CSS variable makes it possible to tint elevation of an element. It takes any CSS colour, including a colour token.
  • ​
    --shadow-intensity CSS variable makes it possible to control the intensity/strength of an element's elevation.

To customise a shadow colour or shadow intensity on a specific instance, use the raw elevation value directly from the theme:

import { theme } from '@volue/wave-react';

{ boxShadow: '$elevationS' } syntax will not work with the custom CSS variables on the instance, because it resolves elevation key to the global CSS variable.


Z-index tokens#

The z-index scale orders surfaces that overlap, in steps of 100. A surface with a higher step covers one with a lower step.

Token
Value
CSS variable
1
100
--z-index-1
2
200
--z-index-2
3
300
--z-index-3
4
400
--z-index-4
5
500
--z-index-5
6
600
--z-index-6
7
700
--z-index-7
8
800
--z-index-8
9
900
--z-index-9
10
1000
--z-index-10

Usage#

Z-index scale values can be applied to the zIndex CSS property. The first box below has the highest step, so it covers the boxes that come after it.