Foundations
Elevation & Shadow System
Elevation controls visual depth through shadows. 6 semantic levels (None, Surface, Raised, Overlay, Sticky, Modal) are available via the Elevation enum, CSS design tokens, and Tailwind utility classes.
Overview
Elevation creates the perception of depth and visual hierarchy by applying MD3-standard two-layer box-shadow values. The system provides 6 semantic levels via the Elevation enum: None (0), Surface (1), Raised (2), Overlay (3), Sticky (4), and Modal (5). Each level maps to a CSS custom property (--ui-elevation-N) and a Tailwind utility class (shadow-elevation-N). Components use the type-safe Elevation enum through the shared ElevationClass helper.
Live Elevation Comparison
All 6 elevation levels rendered side by side. Each card applies its respective shadow-elevation-N class so you can compare the visual depth at each level.
0
None
1
Surface
2
Raised
3
Overlay
4
Sticky
5
Modal
CSS Token Reference
Each elevation level is backed by a CSS custom property that resolves to a box-shadow value. The Tailwind theme maps these tokens to shadow-elevation-N utility classes.
| Level | Enum Member | CSS Token | Tailwind Class | Default Shadow Value |
|---|---|---|---|---|
| 0 | Elevation.None | --ui-elevation-0 | shadow-elevation-0 | none |
| 1 | Elevation.Surface | --ui-elevation-1 | shadow-elevation-1 | 0 1px 2px rgba(0,0,0,0.30), 0 1px 3px 1px rgba(0,0,0,0.15) |
| 2 | Elevation.Raised | --ui-elevation-2 | shadow-elevation-2 | 0 1px 2px rgba(0,0,0,0.30), 0 2px 6px 2px rgba(0,0,0,0.15) |
| 3 | Elevation.Overlay | --ui-elevation-3 | shadow-elevation-3 | 0 1px 3px rgba(0,0,0,0.30), 0 4px 8px 3px rgba(0,0,0,0.15) |
| 4 | Elevation.Sticky | --ui-elevation-4 | shadow-elevation-4 | 0 2px 3px rgba(0,0,0,0.30), 0 6px 10px 4px rgba(0,0,0,0.15) |
| 5 | Elevation.Modal | --ui-elevation-5 | shadow-elevation-5 | 0 4px 4px rgba(0,0,0,0.30), 0 8px 12px 6px rgba(0,0,0,0.15) |
Semantic Defaults
Components ship with sensible default elevation levels mapped to Elevation enum members. Surface elements default to Elevation.Surface, overlays use Elevation.Overlay, and modals use Elevation.Modal. All defaults can be overridden via the Elevation parameter.
Surface components (Elevation.Surface)
| Component | Default Level |
|---|---|
| Card | Elevation.Surface |
| FeatureCard | Elevation.Surface |
| StatCard | Elevation.Surface |
| Alert | Elevation.Surface |
| Section | Elevation.Surface |
| ActionBar | Elevation.Surface |
| PageHero | Elevation.Surface |
| Calendar | Elevation.Surface |
| UnsavedChangesBar | Elevation.Surface |
Overlay / popup components (Raised – Modal)
| Component | Default Level |
|---|---|
| Modal | Elevation.Modal |
| ConfirmDialog | Elevation.Modal |
| Drawer | Elevation.Sticky |
| Popover | Elevation.Overlay |
| Menu | Elevation.Overlay |
| Snackbar | Elevation.Overlay |
| Tooltip | Elevation.Raised |
Dropdown components (Elevation.Overlay)
| Component | Default Level |
|---|---|
| Autocomplete | Elevation.Overlay |
| MultiSelect | Elevation.Overlay |
| SearchInput | Elevation.Overlay |
| SelectInput | Elevation.Overlay |
| DateInput | Elevation.Overlay |
| DateRangePicker | Elevation.Overlay |
| DateTimePicker | Elevation.Overlay |
| TimeInput | Elevation.Overlay |
| TimeSpanPicker | Elevation.Overlay |
Surface Tint Overlay (MD3)
MD3 elevation combines shadow with a Surface Tint Overlay: a semi-transparent layer of the Primary color whose intensity increases with elevation level. This is especially important in Dark Mode where shadows are barely visible — the tint becomes the primary visual depth cue. The tint is applied via background-image using color-mix() and is fully theme-configurable.
0%
None
5%
Surface
8%
Raised
11%
Overlay
12%
Sticky
14%
Modal
Dark Mode
Switch to Dark Mode to see the Surface Tint effect most clearly. In Dark Mode, the tint becomes the primary visual indicator of depth since shadows are barely visible on dark backgrounds.
ElevationClass Helper
ComponentStyleHelper.ElevationClass(Elevation level) generates the Tailwind shadow class for a given Elevation enum value. The type-safe enum ensures only valid levels (0-5) are used.
ElevationClass usage
The helper method and typical usage patterns in component code.
Type-safe enum
Using the Elevation enum ensures compile-time safety. Invalid integer values cause build errors instead of silent runtime clamping.
Show code
Copy code
// Models/Elevation.cs
public enum Elevation
{
None = 0, // no shadow
Surface = 1, // cards, panels, navigation bars
Raised = 2, // elevated buttons, tooltips
Overlay = 3, // menus, dropdowns, snackbar
Sticky = 4, // navigation drawer (modal)
Modal = 5 // modal dialogs
}
// Helpers/ComponentStyleHelper.cs
public static string ElevationClass(Elevation level)
=> $"shadow-elevation-{(int)level}";
// Usage
<Card Elevation="Elevation.Surface" />
<Modal Elevation="Elevation.Modal" />
<Card Elevation="Elevation.None" /> // no shadowFile Reference
| File | Purpose |
|---|---|
| Helpers/ComponentStyleHelper.cs | ElevationClass method — converts Elevation enum to shadow-elevation-N class string |
| Styles/app.css | Elevation CSS tokens — maps --ui-elevation-N to Tailwind shadow theme |