Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already include this feature request, without success.
Describe the Feature Request
Sheet modals that are sized according to their content. If the content exceeds the max-height, I would expect it to be scrollable. If the height of the content changes, the sheet modal should also change its height accordingly. Changing breakpoints is not possible, swiping down dismisses the sheet. It would also be nice if the height of the keyboard could be accounted for, if it is open (or just expand to max-height).
Describe the Use Case
We find ourselves more and more in situations where an auto-height sheet modal would come in very handy. For example we recently added a new payment flow in our app which makes use of different sheets for e.g. showing payment status, entering payment details, and in a lot of these cases we just wanted the sheet modal to be the size of its content. This is currently hard to do when considering different screen sizes on different devices.
A | B |
---|---|
![]() |
![]() |
A lot of native sheets behave that way too:
Twitter A | Twitter B | Twitter C |
---|---|---|
![]() |
![]() |
![]() |
Apple Maps A | Apple Maps B |
---|---|
![]() |
![]() |
Describe Preferred Solution
Setting initialBreakpoint
to auto
could be an possible option to control the feature. Setting the breakpoints
array would not have any effect if initialBreakpoint
is set to auto
.
Describe Alternatives
We tried to do it with custom css but it broke the sheets enter animation. Also, it would just be nice if it would be supported out of the box :)
ion-modal.auto-height {
--height: auto;
--max-height: 90vh;
div.content-wrapper {
overflow-y: scroll;
}
}
Related Code
No response
Additional Information
No response