EnterUI
DocsComponentsThemesExamplesDonation
Get Started
      • Container
      • Spacer
      • VStack
      • HStack
      • ZStack
      • Grid
      • LazyVGrid
      • LazyHGrid

Default usage

  1. EnterUI
  2. /Docs
  3. /Layout and Utilities
  4. /Layout Primitives
  5. /Containers
  6. /ZStack
Updated 3 October 2026

ZStack

A layered layout primitive inspired by SwiftUI.

ZStack layers children in the same grid area without forcing absolute positioning. It is useful for badges, status overlays, empty states, and media labels.

#Default usage

ZStack

Children share the same grid cell by default.

Base layer

Overlay
Code
<ZStack align="center" justify="center">
  <Card><CardContent><Text tone="muted">Base layer</Text></CardContent></Card>
  <Badge variant="info">Overlay</Badge>
</ZStack>

#Import

Code
import { Badge, Card, ZStack } from "@froggdesign/enter-ui-react";

#Alignment

Alignment

Align and justify control where each layer sits inside the stack.

Release card

Ready

#Patterns

Layered status

Use ZStack for simple layered UI without extra positioning wrappers.

Build health

Production package checks.

Typecheck, test, and build are tracked together.

Passing

#Accessibility

ZStack is layout-only and does not change child semantics. Avoid duplicating meaningful content across layers, and make decorative images use empty alt text.

#API

  • as: div, section, article, main, aside, nav, header, or footer.
  • align: start, center, end, or stretch.
  • justify: start, center, end, or stretch.
  • fullWidth: sets width to 100%.
  • top, right, bottom, left: external spacing (margin).
  • padding, paddingTop, paddingRight, paddingBottom, paddingLeft: internal spacing.
  • Extends native props for the rendered element and supports className.

#Spacing

Code
<ZStack top={8} paddingLeft={12} align="center" justify="center">
  <Card>
    <CardContent>
      <Text tone="muted">Overlay stack</Text>
    </CardContent>
  </Card>
  <Badge variant="info">New</Badge>
</ZStack>

#Styling

ZStack uses .eui-zstack and CSS Grid layering. Direct children share the same grid cell, which keeps overlays predictable without requiring custom absolute positioning for simple layer patterns.

PreviousHStack
NextGrid
On this page
  • Default usage
  • Import
  • Alignment
  • Patterns
  • Accessibility
  • API
  • Spacing
  • Styling