<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Shape/capsule(style:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI5ShapePA2A7CapsuleVRszrlE7capsule5styleAeA18RoundedCornerStyleO_tFZ"
  },
  "title" : "capsule(style:)"
}
-->

# capsule(style:)

A capsule shape aligned inside the frame of the view containing it.

```
@export(implementation) static func capsule(style: RoundedCornerStyle) -> Self
```

## Discussion

A capsule shape is equivalent to a rounded rectangle where the corner
radius is chosen as half the length of the rectangle’s smallest edge.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)