Interactive previews iPhone

ContainerRelativeShape

A shape that is replaced by an inset version of the current container shape. If no container shape was defined, is replaced by a rectangle

ContainerRelativeShape - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview

Platform Compatibility

iOS 14.0+ iPadOS 14.0+ macOS 11.0+ watchOS 7.0+ tvOS 14.0+ visionOS 1.0+

Tags

SwiftUI Code

Docs
VStack {
    Text("Foo")
    VStack {
        Text("Bar")
        Text("Foo")
            .padding()
            .background(ContainerRelativeShape().fill(Color.green))
    }
    .padding()
        .background(ContainerRelativeShape().fill(Color.red))

}
.padding()
    .background(.blue, in: RoundedRectangle(cornerRadius: 40))

Found an issue or have a suggestion?

Created: June 12, 2025Updated: December 27, 2025

Explore Other Components

Browse all
Multiple Sources Picker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Multiple Sources Picker

Creates a picker that updates the selected property for all sources.

NavigationControlGroupStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

NavigationControlGroupStyle

The navigation control group style

Swipe Action - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Swipe Action

Adds custom swipe actions to a row in a list or container, notifying you when the actions are revealed or dismissed.

Tab View Customization Behavior - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Tab View Customization Behavior

Configures the customization behavior of customizable tab view content.

Overlay Arrangement ZIndex - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview
environment

Overlay Arrangement ZIndex

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

Color Variants - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
modifier

Color Variants

HierarchicalShapeStyle, a shape style that maps to one of the numbered content styles

Link - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Link

A control for navigating to a URL

Custom Preview Item ShareLink  - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Custom Preview Item ShareLink

Creates an instance, with a custom label, that presents the share interface