ZStack
ZStack
is used to stack child elements in depth.
Box
Box
Box
Box
<ZStack>
{["info", "success", "warning", "error"].map((bg, index) => (
<Box key={index} bg={bg} color="white" p="md">
Box
</Box>
))}
</ZStack>
Usage
import { ZStack } from "@yamada-ui/react"
import { ZStack } from "@/components/ui"
import { ZStack } from "@workspaces/ui"
<ZStack />
Changing Direction
To change the direction, set direction
to "start"
, "end-end"
, etc.
Box
Box
Box
Box
<ZStack direction="start">
{["info", "success", "warning", "error"].map((bg, index) => (
<Box key={index} bg={bg} color="white" p="md">
Box
</Box>
))}
</ZStack>
Reversing Direction
To reverse the direction, set reverse
to true
.
Box
Box
Box
Box
<ZStack direction="center-start" reverse>
{["info", "success", "warning", "error"].map((bg, index) => (
<Box key={index} bg={bg} color="white" p="md">
Box
</Box>
))}
</ZStack>