Description
The FlexBasis
property in the BaseStyles
class represents the flex-basis
CSS property. This property specifies the initial main size of a flex item. It can be set to a specific length or percentage, or it can be set to auto
to use the item's content size as the basis.
Usage
To use the FlexBasis
property, you can assign it a value of type Sandbox.UI.Length
, which can be a specific length (e.g., 100px
, 50%
) or auto
. This property is nullable, meaning it can also be set to null
to remove any previously set value.
Example
// Example of setting the FlexBasis property
var styles = new BaseStyles();
styles.FlexBasis = new Length(100, LengthUnit.Pixel); // Sets the flex-basis to 100 pixels
// Example of setting the FlexBasis to a percentage
styles.FlexBasis = new Length(50, LengthUnit.Percent); // Sets the flex-basis to 50%
// Example of setting the FlexBasis to auto
styles.FlexBasis = Length.Auto; // Sets the flex-basis to auto
// Example of clearing the FlexBasis
styles.FlexBasis = null; // Removes the flex-basis setting