I\'m using amp-list and I would like to have a dynamic height based on the results that I got. There is a way to do it? I couldn\'t get it done.
There is no dynamic layout in AMP (this is to avoid reflow while the page is loading, which is one of the big advantages of AMP). However, the amp-list will automatically take more space if required (and available).
You can do the following three things to support this:
Here is what the official docs say about this:
If amp-list needs more space after loading it requests the AMP runtime to update its height using the normal AMP flow. If AMP Runtime cannot satisfy the request for new height, it will display overflow element when available. Notice however, the typical placement of amp-list elements at the bottom of the document almost always guarantees that AMP Runtime can resize it.
source: https://www.ampproject.org/docs/reference/components/amp-list