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#
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)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)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)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)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-colorCSS variable makes it possible to tint elevation of an element. It takes any CSS colour, including a colour token. -
--shadow-intensityCSS 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.
100--z-index-1200--z-index-2300--z-index-3400--z-index-4500--z-index-5600--z-index-6700--z-index-7800--z-index-8900--z-index-91000--z-index-10Usage#
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.