z-index
The CSS property that sets which positioned elements appear in front of others.
In more detail
Picking arbitrary large numbers leads to escalating z-index wars. A design system defines a small scale of z-index tokens, for example dropdown, sticky, modal and toast, so layers always stack predictably.
Related terms
- stacking context — A group of elements that the browser layers together, so their z-index values only compete with each other and not with the rest of the page.
- design token — A named design decision, such as a colour, font size or spacing value, stored as data so every platform can use the same value.
- overlay — Any piece of interface that appears on top of the page, such as a modal dialog, popover, tooltip, menu or toast.
- portal — A React feature, createPortal, that renders a component's children into a different place in the DOM, usually document.body.
Taught in
- Overlay Architecture: Portals, Stacking Contexts & Backdrops — Design Systems & Component Engineering
- React Portals: Escaping Stacking Contexts for Modals — React 19 & Modern Component Architecture