Presentation Detents Modifier

Set the available detents for an enclosing Sheet.

Updated over a week ago

Overview

A detent refers to the available sizes that a Sheet can appear as. The default size is Large, but you can apply the Presentation Detents modifier to change the size or provide more than one detent, so users can drag the Sheet to resize it.

You can choose from the following set of detents:

  • Large - This detent adapts to cover the screen while leaving a narrow strip of the background visible.

  • Medium - This detent takes up half of the screen, adapting to each screen size.

  • Fraction - This detent takes up a set fraction of the screen, adapting to each screen size.

  • Fixed - This detent takes up a fixed amount of points on the screen and will remain that size on all screen sizes.

Note

Your app will always display the smallest detent first.

Application

To apply a detent or a set of detents, add the Presentation Detents modifier to the instance of your Sheet component. You can either edit the Large detent by clicking on it and selecting a different detent, or click on the plus (+) icon to add additional detents.

By default, the Sheet will be dismissed by swiping down.

Did this answer your question?