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
Connect Wizard

Connect Wizard

Unlock insights App Store Connect doesn’t show you.

Get Started

Explore Other Components

Browse all
Move Disabled - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
modifier

Move Disabled

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

Remove Toolbar Item Margin - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Remove Toolbar Item Margin

Configures whether the content margins are removed.

GroupBox With Label - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

GroupBox With Label

A GroupBox with Label

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

GroupBox

A simple GroupBox

Stepped Slider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Stepped Slider

Creates a slider to select a value from a given range, subject to a step increment

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

AccessoryCircularGaugeStyle

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

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

WheelPickerStyle

A picker style that presents the options in a scrollable wheel that shows the selected option and a few neighboring options.

Container Content Margins - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Container Content Margins

Adds the margins of the container the view is in.