---
title: "Overlay Arrangement ZIndex | Explore SwiftUI"
description: "The z-index for a view within an overlay arrangement view. Learn how to use Overlay Arrangement ZIndex in SwiftUI with visual code examples."
canonical_url: "https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex"
meta:
  author: "Explore SwiftUI"
  "og:description": "The z-index for a view within an overlay arrangement view. Learn how to use Overlay Arrangement ZIndex in SwiftUI with visual code examples."
  "og:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Overlay%2BArrangement%2BZIndex%2Cdescription_The%2Bz-index%2Bfor%2Ba%2Bview%2Bwithin%2Ban%2Boverlay%2Barrangement%2Bview.%2Ccategory_ArrangementView%2Cimage_~L2FwaS9pbWFnZXMvMjUyL3ZhcmlhbnRzLzE5MDY~dj0xNzkyNDgwMjg5NzY0JnI9MiZ3PTY0MCZoPTQ4MCZmPXBuZw%2CimageMode_fit%2CimagePosition_center%2CimageFrame_~Ym9yZGVyLXJhZGl1czogMzNweCAwcHggMHB4IDMzcHg7IGJvcmRlcjogMXB4IHNvbGlkIHJnYmEoMCwwLDAsMC4wNik7IGJvcmRlci1yaWdodDogMDsgYm94LXNoYWRvdzogMCAtMTBweCA1MHB4IHJnYmEoMzcsOTksMjM1LDAuMTgpOw%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIl19%2Cp_Ii9saWJyYXJ5L2FycmFuZ2VtZW50dmlldy9vdmVybGF5LWFycmFuZ2VtZW50LXppbmRleCI%2Cs_OvnRMu-9cVhBpn10.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Overlay Arrangement ZIndex | Explore SwiftUI"
  "twitter:description": "The z-index for a view within an overlay arrangement view. Learn how to use Overlay Arrangement ZIndex in SwiftUI with visual code examples."
  "twitter:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Overlay%2BArrangement%2BZIndex%2Cdescription_The%2Bz-index%2Bfor%2Ba%2Bview%2Bwithin%2Ban%2Boverlay%2Barrangement%2Bview.%2Ccategory_ArrangementView%2Cimage_~L2FwaS9pbWFnZXMvMjUyL3ZhcmlhbnRzLzE5MDY~dj0xNzkyNDgwMjg5NzY0JnI9MiZ3PTY0MCZoPTQ4MCZmPXBuZw%2CimageMode_fit%2CimagePosition_center%2CimageFrame_~Ym9yZGVyLXJhZGl1czogMzNweCAwcHggMHB4IDMzcHg7IGJvcmRlcjogMXB4IHNvbGlkIHJnYmEoMCwwLDAsMC4wNik7IGJvcmRlci1yaWdodDogMDsgYm94LXNoYWRvdzogMCAtMTBweCA1MHB4IHJnYmEoMzcsOTksMjM1LDAuMTgpOw%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIl19%2Cp_Ii9saWJyYXJ5L2FycmFuZ2VtZW50dmlldy9vdmVybGF5LWFycmFuZ2VtZW50LXppbmRleCI%2Cs_OvnRMu-9cVhBpn10.png"
  "twitter:title": "Overlay Arrangement ZIndex | Explore SwiftUI"
---

> Index of every page on this site: [llms.txt](https://exploreswiftui.com/llms.txt)

**Interactive previews**[ iPhone Duo](https://exploreswiftui.com/duo?element=252)

# **Overlay Arrangement ZIndex**

The z-index for a view within an overlay arrangement view.

![Overlay Arrangement ZIndex - Preview Not Available](https://exploreswiftui.com/api/images/252/variants/1906?v=1792480289764&r=2&w=800&q=80&f=webp)

### **Platform Compatibility**

iOS 27.1+ iPadOS 27.1+

### **Tags**

### **SwiftUI Code**

[ Docs](https://developer.apple.com/documentation/SwiftUI/EnvironmentValues/overlayArrangementZIndex)

```
var body: some View {
    ArrangementView {
        SecondaryView()
    } secondary: {
        Color.orange
    }
    .arrangementViewStyle(.overlay)
}

struct SecondaryView: View {
    @Environment(\.overlayArrangementZIndex) var zIndex

    var body: some View {
        Color.blue
            .frame(width: 210, height: 210)
            .opacity(zIndex == 0 ? 1.0 : 0)
    }
}
```

### **Found an issue or have a suggestion?**

Created: September 28, 2026Updated: October 20, 2026

### **More ArrangementView Components **

[**View all **](https://exploreswiftui.com/library/arrangementview)

![Overlay Arrangement Edge - iOS on iPhone Duo - Landscape - Partially Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/251/variants/1787?v=1790586084694&r=2&w=412&q=75&f=webp)

### **Overlay Arrangement Edge**

The horizontal edge a view in an overlay arrangement occupies when the arrangement transitions to a horizontal layout. In this case, the primary view overlays the secondary view at the trailing edge when the screen is partially open in landscape.

![Overlay Arrangement Style - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/250/variants/1777?v=1790584733410&r=2&w=412&q=75&f=webp)

### **Overlay Arrangement Style**

An arrangement view style that layers the primary view over the secondary view in z-order.

![Only Horizontal Split Arrangement Style - iOS on iPhone Duo - Portrait - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/245/variants/1614?v=1791207712827&r=2&w=412&q=75&f=webp)

### **Only Horizontal Split Arrangement Style**

Creates a horizontal split arrangement only in portrait orientation. In landscape orientation, no split is applied.

![Split Arrangement Layout Ratio - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/244/variants/1564?v=1790273511100&r=2&w=412&q=75&f=webp)

### **Split Arrangement Layout Ratio**

Sets the preferred size ratio for an arrangement view in a split style. Use this modifier when you want to customize the size of the view compared to its other views in the split layout.

![ArrangementView - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/243/variants/1530?v=1790273526551&r=2&w=412&q=75&f=webp)

### **ArrangementView**

Creates an arrangement view with a primary and secondary view.

### **Explore Other Components **

[**Browse all **](https://exploreswiftui.com/)

![Move Disabled - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/128/variants/361?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Move Disabled**

Adds a condition for whether the view’s view hierarchy is movable.

![Sheet Size - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/137/variants/432?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Sheet Size**

Sets the available detents for the enclosing sheet.

![ProgressView Colors - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/81/variants/24?v=1790073478842&r=2&w=412&q=75&f=webp)

### **ProgressView Colors**

Customizing the colors of the ProgressView

![On Primary Photos Picker Action - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/267/variants/2251?v=1794910789851&r=2&w=412&q=75&f=webp)

### **On Primary Photos Picker Action**

Sets the primary action handler for the Photos picker.

![Prioritize Sheet Content Scrolling - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/141/variants/466?v=1795201620589&r=2&w=412&q=75&f=webp)

### **Prioritize Sheet Content Scrolling**

Configures the behavior of swipe gestures on a presentation. PresentationContentInteraction.scrolls prioritizes scrolling the content over resizing the sheet.

![Photos Picker Prompt - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/269/variants/2259?v=1794910719258&r=2&w=412&q=75&f=webp)

### **Photos Picker Prompt**

Sets the prompt of the Photos picker.

![ LinearGaugeStyle - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/46/variants/264?v=1790073478842&r=2&w=412&q=75&f=webp)

### **LinearGaugeStyle**

A gauge style that displays a bar with a marker that appears at a point along the bar to indicate the gauge’s current value

![Store Cancellation Button - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/218/variants/134?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Store Cancellation Button**

A type of button that people use to dismiss the current store presentation. It is displayed by default and only works in a sheet.

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://exploreswiftui.com/#website","@type":"WebSite","description":"A visual library for SwiftUI APIs, components, and modifiers","inLanguage":"en-US","name":"Explore SwiftUI","url":"https://exploreswiftui.com/","publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex#webpage","@type":"WebPage","dateModified":"2026-10-20T07:11:29.830Z","datePublished":"2026-09-28T09:09:51.984Z","description":"The z-index for a view within an overlay arrangement view. Learn how to use Overlay Arrangement ZIndex in SwiftUI with visual code examples.","name":"Overlay Arrangement ZIndex","url":"https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex","breadcrumb":{"@id":"https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex#breadcrumb"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"},"mainEntity":{"@id":"https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex#article"},"potentialAction":[{"@type":"ReadAction","target":["https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex"]}],"primaryImageOfPage":{"@id":"https://exploreswiftui.com/#logo"}},{"@id":"https://exploreswiftui.com/#identity","@type":"Organization","description":"A visual library for SwiftUI APIs, components, and modifiers","name":"Explore SwiftUI","url":"https://exploreswiftui.com","logo":{"@id":"https://exploreswiftui.com/#logo"},"sameAs":["https://x.com/Typ0genius","https://mastodon.social/@Typ0genius"]},{"@id":"https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex#article","citation":"https://developer.apple.com/documentation/SwiftUI/EnvironmentValues/overlayArrangementZIndex","dateModified":"2026-10-20T07:11:29.830Z","datePublished":"2026-09-28T09:09:51.984Z","description":"The z-index for a view within an overlay arrangement view. Learn how to use Overlay Arrangement ZIndex in SwiftUI with visual code examples.","headline":"Overlay Arrangement ZIndex","inLanguage":"en-US","name":"Overlay Arrangement ZIndex","thumbnailUrl":"https://exploreswiftui.com/api/images/252/variants/1906?v=1792480289764&r=2","url":"https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex","@type":["Article","TechArticle"],"about":{"@type":"Thing","name":"SwiftUI"},"author":{"@id":"https://exploreswiftui.com/#identity"},"hasPart":{"@id":"https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex#source-code"},"image":{"@id":"https://exploreswiftui.com/#/schema/image/1"},"isPartOf":{"@id":"https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex#webpage"},"mainEntityOfPage":{"@id":"https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex#webpage"},"publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex#source-code","@type":"SoftwareSourceCode","codeSampleType":"full example","description":"The z-index for a view within an overlay arrangement view. Learn how to use Overlay Arrangement ZIndex in SwiftUI with visual code examples.","name":"Overlay Arrangement ZIndex SwiftUI Example","programmingLanguage":"Swift","runtimePlatform":"SwiftUI","text":"var body: some View {\n    ArrangementView {\n        SecondaryView()\n    } secondary: {\n        Color.orange\n    }\n    .arrangementViewStyle(.overlay)\n}\n\nstruct SecondaryView: View {\n    @Environment(\\.overlayArrangementZIndex) var zIndex\n\n    var body: some View {\n        Color.blue\n            .frame(width: 210, height: 210)\n            .opacity(zIndex == 0 ? 1.0 : 0)\n    }\n}","about":[{"@type":"Thing","name":"SwiftUI"},{"@type":"Thing","name":"ArrangementView"},{"@type":"Thing","name":"Overlay Arrangement ZIndex"}]},{"@id":"https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://exploreswiftui.com","position":1},{"@type":"ListItem","name":"ArrangementView","item":"https://exploreswiftui.com/library/arrangementview","position":2},{"@type":"ListItem","name":"Overlay Arrangement ZIndex","item":"https://exploreswiftui.com/library/arrangementview/overlay-arrangement-zindex","position":3}]},{"@id":"https://exploreswiftui.com/#logo","@type":"ImageObject","caption":"Explore SwiftUI","contentUrl":"https://exploreswiftui.com/apple-touch-icon.png","inLanguage":"en","url":"https://exploreswiftui.com/apple-touch-icon.png"},{"@id":"https://exploreswiftui.com/#/schema/image/1","@type":"ImageObject","contentUrl":"https://exploreswiftui.com/api/images/252/variants/1906?v=1792480289764&r=2","inLanguage":"en","url":"https://exploreswiftui.com/api/images/252/variants/1906?v=1792480289764&r=2"}]}
```