Modifiers
zIndex
Sets the z-index (display order) of a view.
zIndex(index)
| Parameter | Type | Description |
|---|---|---|
index | number | The z-index value. |
Sets the z-index (display order) of a view.
Returns: ModifierConfig
See: Official SwiftUI documentation.
Works with
You can add zIndex to any view. It changes what you see on 2 of the 39 components.
No visible effect
These components accept it, but you see no change.
| Component | Why nothing happens |
|---|---|
| VStack | It changes the order of views that cover each other in the same parent, and VStack does not stack its children. |
| HStack | It changes the order of views that cover each other in the same parent, and HStack does not stack its children. |
| LazyVStack | It changes the order of views that cover each other in the same parent, and LazyVStack does not stack its children. |
| LazyHStack | It changes the order of views that cover each other in the same parent, and LazyHStack does not stack its children. |
| Group | It changes the order of views that cover each other in the same parent, and Group does not stack its children. |
| Spacer | It changes the order of views that cover each other in the same parent, and Spacer does not stack its children. |
| Divider | It changes the order of views that cover each other in the same parent, and Divider does not stack its children. |
| ScrollView | It changes the order of views that cover each other in the same parent, and ScrollView does not stack its children. |
| Button | It changes the order of views that cover each other in the same parent, and Button does not stack its children. |
| Toggle | It changes the order of views that cover each other in the same parent, and Toggle does not stack its children. |
| Checkbox | It changes the order of views that cover each other in the same parent, and Checkbox does not stack its children. |
| Slider | It changes the order of views that cover each other in the same parent, and Slider does not stack its children. |
| Picker | It changes the order of views that cover each other in the same parent, and Picker does not stack its children. |
| DatePicker | It changes the order of views that cover each other in the same parent, and DatePicker does not stack its children. |
| ColorPicker | It changes the order of views that cover each other in the same parent, and ColorPicker does not stack its children. |
| Link | It changes the order of views that cover each other in the same parent, and Link does not stack its children. |
| ControlGroup | It changes the order of views that cover each other in the same parent, and ControlGroup does not stack its children. |
| Menu | It changes the order of views that cover each other in the same parent, and Menu does not stack its children. |
| ContextMenu | It changes the order of views that cover each other in the same parent, and ContextMenu does not stack its children. |
| TextField | It changes the order of views that cover each other in the same parent, and TextField does not stack its children. |
| SecureField | It changes the order of views that cover each other in the same parent, and SecureField does not stack its children. |
| Text | It changes the order of views that cover each other in the same parent, and Text does not stack its children. |
| Label | It changes the order of views that cover each other in the same parent, and Label does not stack its children. |
| Image | It changes the order of views that cover each other in the same parent, and Image does not stack its children. |
| List | It changes the order of views that cover each other in the same parent, and List does not stack its children. |
| Form | It changes the order of views that cover each other in the same parent, and Form does not stack its children. |
| Section | It changes the order of views that cover each other in the same parent, and Section does not stack its children. |
| DisclosureGroup | It changes the order of views that cover each other in the same parent, and DisclosureGroup does not stack its children. |
| SwipeActions | It changes the order of views that cover each other in the same parent, and SwipeActions does not stack its children. |
| BottomSheet | It changes the order of views that cover each other in the same parent, and BottomSheet does not stack its children. |
| Alert | It changes the order of views that cover each other in the same parent, and Alert does not stack its children. |
| ConfirmationDialog | It changes the order of views that cover each other in the same parent, and ConfirmationDialog does not stack its children. |
| Popover | It changes the order of views that cover each other in the same parent, and Popover does not stack its children. |
| ProgressView | It changes the order of views that cover each other in the same parent, and ProgressView does not stack its children. |
| Gauge | It changes the order of views that cover each other in the same parent, and Gauge does not stack its children. |
| TabView | It changes the order of views that cover each other in the same parent, and TabView does not stack its children. |
| AccessoryWidgetBackground | It changes the order of views that cover each other in the same parent, and AccessoryWidgetBackground does not stack its children. |
Sources
The original Expo docs for this page:
- zIndex (Modifiers) (
source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/modifiers.md)