---
title: "presentationDetents(_:selection:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/presentationdetents(_:selection:)"
---

# presentationDetents(_:selection:)

Sets the available detents for the enclosing sheet, giving you programmatic control of the currently selected detent.

## Declaration

```swift
nonisolated func presentationDetents(_ detents: Set<PresentationDetent>, selection: Binding<PresentationDetent>) -> some View

```

## Parameters

- `detents`: A set of supported detents for the sheet. If you provide more that one detent, people can drag the sheet to resize it.
- `selection`: A doc://com.apple.SwiftUI/documentation/SwiftUI/Binding to the currently selected detent. Ensure that the value matches one of the detents that you provide for the detents parameter.

## Discussion

Discussion By default, sheets support the large detent. struct ContentView: View {     @State private var showSettings = false     @State private var settingsDetent = PresentationDetent.medium

var body: some View {         Button("View Settings") {             showSettings = true         }         .sheet(isPresented: $showSettings) {             SettingsView()                 .presentationDetents(                     [.medium, .large],                     selection: $settingsDetent                  )         }     } }

## See Also

### Configuring a sheet’s height

- [presentationDetents(_:)](swiftui/view/presentationdetents(_:).md)
- [presentationContentInteraction(_:)](swiftui/view/presentationcontentinteraction(_:).md)
- [presentationDragIndicator(_:)](swiftui/view/presentationdragindicator(_:).md)
- [PresentationDetent](swiftui/presentationdetent.md)
- [CustomPresentationDetent](swiftui/custompresentationdetent.md)
- [PresentationContentInteraction](swiftui/presentationcontentinteraction.md)
