Skip to content

Scale to fit

This container attempts to scale down its child so it fits in the available space. This approach is useful when your content usually fits in the available space. For special situations, instead of wrapping the content to the next page or causing the infinite layout exception, it may make the content a little smaller to preserve the document look and feel.

.Column(column =>
    var text = Placeholders.Paragraph();

    foreach (var i in Enumerable.Range(2, 5))
            .Width(i * 40) // sizes from 80x40 to 240x120
            .Height(i * 20)



Please notice that this component scales the available space. That means that you may still encounter situations where the child does not fit, e.g. when a child tries to enforce a specific aspect ratio.

The process performs a binary search algorithm - in some cases this may cause performance issues.

Released under the MIT License