Z-Index for components is based on the component’s category (table 1) times a multiplier determined by the section of the site the component is placed (table 2).
This approach allows the same component in the header to have a different z-index than one placed in the body or a modal. For example, the search combobox in the header can have a higher z-index than the main nav, but the search combobox in the body will not appear above the main nav dropdowns.
The default multiplier is set as a root custom property to 1.
Set the multiplier for each section of the site:
<header style="--z:100"></header>
<main>
<div class="modal" style="--z:1000"></div>
</main>Write the z-index property using the multiplier:
.combobox__menu {
z-index: calc(var(--z) * 30);
}| Layer | Content |
|---|---|
| 1 | Low level |
| 10 | pseudo element masks (xScroll masks, card link masks, gradient overlays) |
| 11 | content to sit above pseudo masks (.xScroll__above, .card--selectableContent, badges) |
| 20 | sticky toolbars |
| 30 | in-content flyouts (menus, search, dropdowns) |
| 49 | reveal backdrop |
| 50 | reveal |
| 9999 | modal backdrop |
| 10000 | modal |
| Multiplier | Section |
|---|---|
| 100 | Header |
| 1 | Main |
| 100 | Footer |
| 1000 | Modal |