z-index
Utilities for controlling the stack order of an element.
| Class | Effect |
|---|---|
z-<number> |
z-index: <number>; |
z-auto |
z-index: auto; |
z-[<value>] |
z-index: <value>; |
Examples
Section titled “Examples”Basic example
Section titled “Basic example”Use z-<number> to control the stack order of positioned siblings.


if ui.div("flex") { for z, i in ([]string{"z-40", "z-30", "z-20", "z-10", "z-0"}) { ui.key(z) colors := [?]string{"bg-blue-500", "bg-indigo-500", "bg-violet-500", "bg-purple-500", "bg-fuchsia-500"} ui.text(z, ui.cx("relative flex size-16 items-center justify-center rounded-full font-mono text-xs font-bold text-white shadow-lg ring-2 ring-white dark:ring-gray-900", colors[i], z, i > 0 ? "-ml-3" : "")) }}