As far as I know, you’d have to calculate it to make the modal as high as the content.
A possible way would be to:
- Get the height of all child elements
- divide the child elements height with screen height (probably add a few pixels here and there for padding purposes) and multiply by a 100 for the percent value.
- optional: divide the result by 2 to get the optimal top and bottom values to have it centered vertically
Ofcourse you’d also want to add a condition in this matter if the content is larger than the screen on which youd just want the content of the modal to be scrollable.
Ofcourse there are better and more optimal ways to do it but this is the first idea that came in mind.
If something sounds unclear, feel free to message me back.