Skip to main content

Z-Index

Pando uses a named map of values to provide consistent and predictable layering of elements along the z-axis based on the element's purpose.

Map

Pando reserves the 1000-1999 range, plus 50 for non-important style values (borders, etc.). This gives your product the freedom to use the 100-999 range.

In the headless-styles package, we use a structured layering map to organize our z-index values. Here is the map we use for our API:

KeyValueUsage
hide-1
auto'auto'
base0
decorator50psuedo elements, etc. for borders or other
dropdown1000
sticky1100
banner1200
overlay1300
modal1400
popover1500
toast1600
tooltip1700

Helper Functions

Pando also provides some helpers for referencing the keys and values of the z-index map.

Import

import { getZindexKeys, getZindex } from '@pluralsight/headless-styles'

getZindexKeys

function getZindexKeys(): ReturnType

Parameters

This function does not accept any parameters.

Returns

  1. An object consisting of keys and values matching the keys of the z-index map.

getZindex

function getZindex(key: ZindexKey): number | string

Parameters

type ZindexKey = keyof ReturnType<typeof getZindexKeys>

Returns

  1. The z-index value corresponding to the given key from the z-index map.