Elevation
Davaux UI expresses depth through two parallel systems: a graduated elevation scale (0–5) that maps to component layers, and a surface color scale that tints backgrounds in dark mode to reinforce layering without relying on shadow contrast alone.
Elevation scale
Six levels from flat (0) to maximum depth (5). Each level maps to a --dv-elevation-N token. In light mode these are progressively larger, softer box-shadows. In dark mode the shadow values are tighter and darker — surface tinting (see below) carries the depth instead.
/* Apply to any element */
.my-card { box-shadow: var(--dv-elevation-2); }
.my-modal { box-shadow: var(--dv-elevation-4); }
.my-tooltip { box-shadow: var(--dv-elevation-5); }Named shadows
A separate set of decorative shadow tokens — xs through xl — for cases where you want a specific visual weight independent of the component layer hierarchy. These use a multi-layer technique (ambient base + directional spread) for a softer, more diffuse look than the elevation tokens.
/* Paper component accepts a shadow prop */
.decorative-card { box-shadow: var(--dv-shadow-md); }
.hero-image { box-shadow: var(--dv-shadow-xl); }Surface layers
The --dv-surface-N tokens define background colors that step upward through the layer stack. In light mode these stay near-white — shadow contrast communicates depth. In dark mode, where shadows are less visible, each surface level picks up a progressively stronger tint of the primary color so the stack remains readable without shadows alone.
The tinting uses color-mix() (Chrome 111+, Firefox 113+, Safari 16.2+). Older browsers receive static dark-gray fallbacks.
/* Surface scale — use these on element backgrounds */
.page-bg { background: var(--dv-surface-0); }
.sidebar { background: var(--dv-surface-1); }
.card { background: var(--dv-surface-2); }
.modal-body { background: var(--dv-surface-3); }Component usage
These tokens are applied consistently across all built-in components.
| Component | Elevation token | Surface token |
|---|---|---|
Button | elevation-1 (rest) → elevation-2 (hover) | — |
Paper | configurable via shadow prop | surface-2 |
Card | elevation-2 | surface-2 |
Modal | elevation-4 | surface-3 |
Drawer | elevation-4 | surface-3 |
Menu | elevation-5 | surface-2 |
Tooltip | elevation-5 | surface-2 |
Notification | elevation-3 | surface-2 |
CSS Variable Reference
| Token | Light mode | Dark mode |
|---|---|---|
--dv-elevation-0 | none | none |
--dv-elevation-1 | 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1) | 0 1px 3px rgba(0,0,0,0.3) |
--dv-elevation-2 | 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06) | 0 4px 5px rgba(0,0,0,0.35) |
--dv-elevation-3 | 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05) | 0 6px 6px rgba(0,0,0,0.4) |
--dv-elevation-4 | 0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04) | 0 8px 7px rgba(0,0,0,0.45) |
--dv-elevation-5 | 0 25px 50px rgba(0,0,0,0.25) | 0 10px 8px rgba(0,0,0,0.5) |
--dv-shadow-xs … --dv-shadow-xl | Static — same in both modes. Multi-layer ambient + directional. | |
--dv-surface-0 | var(--dv-color-body) — #ffffff | #1a1b1e |
--dv-surface-1 | var(--dv-color-surface) — #f8f9fa | color-mix(primary 5%, surface-0) |
--dv-surface-2 | var(--dv-color-gray-1) — #f1f3f5 | color-mix(primary 8%, surface-0) |
--dv-surface-3 | var(--dv-color-body) | color-mix(primary 11%, surface-0) |
--dv-surface-4 | var(--dv-color-body) | color-mix(primary 12%, surface-0) |
--dv-surface-5 | — | color-mix(primary 14%, surface-0) |