LengthUnit ViewMin

robot_2Generated
code_blocksInput

Description

The ViewMin field of the LengthUnit enum represents a length unit that is a percentage (0-100) of the viewport's smallest side or edge. This unit is useful when you want to size elements relative to the smaller dimension of the viewport, ensuring consistent scaling across different screen sizes and orientations.

Usage

Use LengthUnit.ViewMin when you need to define a length that should adapt to the smallest dimension of the viewport. This is particularly useful for responsive design, where elements need to maintain a consistent appearance regardless of the device's orientation or aspect ratio.

Example

// Example of using LengthUnit.ViewMin in a UI component

public class MyResponsivePanel : Panel
{
    public MyResponsivePanel()
    {
        // Set the width of the panel to 50% of the viewport's smallest side
        Style.Width = Length.Percent(50, LengthUnit.ViewMin);

        // Set the height of the panel to 30% of the viewport's smallest side
        Style.Height = Length.Percent(30, LengthUnit.ViewMin);
    }
}