Spacers
Spacers add space to your designs. Spacers should not be abused, but they can be super handy.
margin
has its issues covered in the space principle and padding
can get lost in code reviews. So, if you want to be super explict about significant space, you can use a simple VSpace
, which shows up in code reviews:
HSpace
Takes the $space?:CSSLength
prop to generate a horizontal space. e.g. you can see the button pushed a bit to the right by a HSpace
:
VSpace
Takes the $space?:CSSLength
prop to generate a vertical space. e.g. you can see the button pushed a bit down by a VSpace
:
Stretch
Takes the $scale?:number
prop (concept covered in scale principle) to generate a stretch amount of space.
Stretch
comes really handy when you want to split items to the sides (left & right) with a stretch space in between as shown below:
Stretch
works automatically for both horizontal and vertical dimensions depending on the parent container. The following two examples demonstrate it with Column(Stretch,Button)
and Row(Stretch,Button)
:
Note that when all items you want to shift are grouped together, you can achieve the same effect by using alignment properties (without using a Stretch
):