Skip to content

playground for auto sized sheets #2793

Closed
@DavidStrausz

Description

@DavidStrausz

Prerequisites

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
Xnapper-2023-02-25-20 28 02 Xnapper-2023-02-25-20 29 25

A lot of native sheets behave that way too:

Twitter A Twitter B Twitter C
Xnapper-2023-02-25-20 22 10 Xnapper-2023-02-25-20 20 25 Xnapper-2023-02-25-20 23 41
Apple Maps A Apple Maps B
Xnapper-2023-02-25-21 57 30 Xnapper-2023-02-25-21 57 51

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    contentIssues related to the contents of the documentation websitefeature requestFeature requests for the documentation website

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions