Shadows
EUI provides 5 shadow sizes (xs, s, m, l, xl) that can be applied in two directions: down (default) and up.
The provided EUI shadow utilities use the underlying theme shadow tokens and automatically add required adjustments for dark mode and high contrast mode that ensure expected visibility.
Never use the underlying shadow tokens separately
Always use the shadow utilities to ensure proper styling.
These shadow utilities handle the following additional style adjustments:
- adds a light, 4-sided
borderstyle in Dark mode to increase elevated item visibility - replaces the
box-shadowin High Contrast mode withborderto ensure visibility in high contrast themes
Usage
ts code block:import { euiShadow } from '@elastic/eui'; const styles = css` ${euiShadow(euiThemeContext, 's')}; ${euiShadow(euiThemeContext, 's', { direction: 'down' })}; `;
Direction: down
Sample | Utility | Style output |
|---|---|---|
euiShadow(euiThemeContext, 'xs', { direction: 'down' }) | euiShadow(euiThemeContext, 'xs', { direction: 'down' }) | Style output
|
euiShadow(euiThemeContext, 's', { direction: 'down' }) | euiShadow(euiThemeContext, 's', { direction: 'down' }) | Style output
|
euiShadow(euiThemeContext, 'm', { direction: 'down' }) | euiShadow(euiThemeContext, 'm', { direction: 'down' }) | Style output
|
euiShadow(euiThemeContext, 'l', { direction: 'down' }) | euiShadow(euiThemeContext, 'l', { direction: 'down' }) | Style output
|
euiShadow(euiThemeContext, 'xl', { direction: 'down' }) | euiShadow(euiThemeContext, 'xl', { direction: 'down' }) | Style output
|