Elevation
Overview
Wave provides a set of elevation values to maintain standardized 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.
#
TokensToken
Value
Preview
Examples
elevationXs
0 1px 2.5px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.08)), 0 3px 9px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.048))
Cards, selects, buttons
elevationS
0 0.4px 2.2px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.022)), 0 1.4px 5px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.04)), 0 5px 14px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.06))
Tooltips, toasts
elevationM
0 0.3px 2px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.015)), 0 1.5px 8px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.024)), 0 4px 16px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.04)), 0 8px 24px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.07))
Dropdowns, popovers, menus, drawers, floating buttons
elevationL
0 0.7px 2px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.015)), 0 1.6px 8px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.024)), 0 3.3px 16px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.034)), 0 5px 26px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.06)), 0 12px 42px hsla(var(--shadow-color, 191, 74%, 6%), calc(var(--shadow-intensity, 1) * 0.08))
Panels, modal dialogs
#
Usage#
Customizing elevationWhen using shadows on a colored background, colored shadows can often look more natural than the default gray-based shadows, which tend to appear washed-out.
-
--shadow-color
CSS variable makes it possible to tint elevation of an element. -
--shadow-intensity
CSS variable makes it possible to control the intensity/strength of an element's elevation.
To customize a shadow color or shadow intensity on a specific instance, use the raw elevation value directly from the theme:
import { theme } from '@volue/wave-react';const Component = styled('div', padding, {'--shadow-color': '191, 74%, 4%',boxShadow: theme.shadows.elevationL.value});
{ boxShadow: '$elevationS' }
syntax will not work with the custom CSS variables on the instance, because it resolves elevation key to the global CSS variable.