---
title: "containerShape(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/containershape(_:)-3br47"
---

# containerShape(_:)

Sets the container shape to use for any container relative shape or concentric rectangle within this view.

## Declaration

```swift
nonisolated func containerShape(_ shape: some RoundedRectangularShape) -> some View

```

## Discussion

Discussion The example below defines a view that shows its content with a rounded rectangle background and the same container shape. Any ContainerRelativeShape within the content matches the rounded rectangle shape from this container inset as appropriate. Any ConcentricRectangle within the content will match the corners to be concentric to the container corners. struct PlatterContainer<Content: View> : View {     @ContentBuilder var content: Content     var body: some View {         content             .padding()             .containerShape(shape)             .background(shape.fill(.background))     }     var shape: RoundedRectangle { RoundedRectangle(cornerRadius: 20) } } note: containerShape(_:)
