CDK virtual scroll - dynamic heights


Is there any timeframe for when cdk virtual scroll will support varying element heights. Until such time I don’t think there’s a way we can upgrade to ionic 7.

We have a message board feature where each element could be a different height depending on if the user posts an image with their message or if a long message has been expanded or not as long messages are initially show truncated to 200 characters.


You should open an issue on the angular cdk repo. But I really don’t think they’ll be doing this anytime soon.

If you absolutely need to have items with multiple heights maybe using just plain infinite-scroll is the best option.
You said you have a message board, usually people don’t go scrolling through messages for too long, and most of the time they don’t need to, so showing, say 50 results first, then just loading the rest as the user scrolls feels more natural.

There are some experiments from the@rx-angular folks that are extremely promising around this.

It’s still pretty early on, but I’ve tested this out with an ionic app and it works pretty well