Markdown redirect frontmatter
Reviewed By: danielbuechele Differential Revision: D6987631 fbshipit-source-id: 8b3431fa885fb94d4a87119b5a5199db0b36b20c
This commit is contained in:
committed by
Facebook Github Bot
parent
740ef6cd9e
commit
3ec41b656f
@@ -4,8 +4,27 @@ title: "Align Items / Self"
|
||||
hasPlayground: true
|
||||
---
|
||||
|
||||
## Align Items / Self
|
||||
## Align Items
|
||||
|
||||
Align items describes how to align children along the cross axis of their container.
|
||||
Align items is very similar to [Justify Content](justify-content) but instead of
|
||||
applying to the main axis, Align Items applies to the cross axis.
|
||||
|
||||
**STRETCH (DEFAULT)** Stretch children of a container to match the height of the container's cross axis.
|
||||
|
||||
**FLEX START** Align children of a container to the start of the container's cross axis.
|
||||
|
||||
**FLEX END** Align children of a container to the end of the container's cross axis.
|
||||
|
||||
**CENTER** Align children of a container in the center of the container's cross axis.
|
||||
|
||||
<controls prop="alignItems"></controls>
|
||||
|
||||
## Align Self
|
||||
|
||||
Align self has the same options and effect as Align Items but instead of
|
||||
affecting the children within a container, you can apply this property to
|
||||
a single child to change its alignment within its parent. `Align Self`
|
||||
overrides any option set by the parent with `Align Items`.
|
||||
|
||||
<controls prop="alignSelf"></controls>
|
||||
|
@@ -6,4 +6,21 @@ hasPlayground: true
|
||||
|
||||
## Flex Direction
|
||||
|
||||
Flex direction controls the direction in which children of a node are laid out.
|
||||
This is also referred to as the main axis. The main axis is the direction in
|
||||
which children are laid out. The cross axis the the axis perpendicular to the
|
||||
main axis, or the axis which wrapping lines are laid out in.
|
||||
|
||||
**ROW (DEFAULT)** Align children from left to right. If [wrapping](flex-wrap) is enabled then
|
||||
the next line will start under the first item on the left of the container.
|
||||
|
||||
**COLUMN** Align children from top to bottom. If [wrapping](flex-wrap) is enabled then
|
||||
the next line will start to the left first item on the top of the container.
|
||||
|
||||
**ROW REVERSE** Align children from right to left. If [wrapping](flex-wrap) is enabled then
|
||||
the next line will start under the first item on the right of the container.
|
||||
|
||||
**COLUMN REVERSE** Align children from bottom to top. If [wrapping](flex-wrap) is enabled then
|
||||
the next line will start to the left first item on the bottom of the container.
|
||||
|
||||
<controls prop="flexDirection"></controls>
|
||||
|
@@ -6,33 +6,27 @@ hasPlayground: true
|
||||
|
||||
## Flex Basis, Grow, and Shrink
|
||||
|
||||
### Flex Grow
|
||||
|
||||
Flex grow describes how any space within a container should be distributed
|
||||
**FLEX GROW** describes how any space within a container should be distributed
|
||||
among its children along the main axis. After laying out its children, a container will
|
||||
distribute any remaining space according to the flex grow values specified by its children.
|
||||
|
||||
flex grow accepts any floating point value >= 0, with 0 being the default value.
|
||||
Flex grow accepts any floating point value >= 0, with 0 being the default value.
|
||||
A container will distribute any remaining space among its children weighted by the child’s flex grow value.
|
||||
|
||||
<controls prop="flexGrow"></controls>
|
||||
|
||||
### Flex Shrink
|
||||
|
||||
Flex shrink describes how to shrink children along the main axis in the
|
||||
**FLEX SHRINK** describes how to shrink children along the main axis in the
|
||||
case that the total size of the children overflow the size of the container on the main axis.
|
||||
flex shrink is very similar to flex grow and can be thought of in the same way if
|
||||
any overflowing size is considered to be negative remaining space.
|
||||
These two properties also work well together by allowing children to grow and shrink as needed.
|
||||
|
||||
flex shrink accepts any floating point value >= 0, with 1 being the default value.
|
||||
Flex shrink accepts any floating point value >= 0, with 1 being the default value.
|
||||
A container will shrink its children weighted by the child’s flex shrink value.
|
||||
|
||||
<controls prop="flexShrink"></controls>
|
||||
|
||||
### Flex Basis
|
||||
|
||||
Flex basis is an axis-independent way of providing the default size of an item
|
||||
**FLEX BASIS** is an axis-independent way of providing the default size of an item
|
||||
along the main axis. Setting the flex basis of a child is similar to setting the Width of that
|
||||
child if its parent is a container with FlexDirection = row or setting the Height of a child
|
||||
if its parent is a container with FlexDirection = column. The flex basis of an item is the
|
||||
|
@@ -6,4 +6,23 @@ hasPlayground: true
|
||||
|
||||
## Justify Content
|
||||
|
||||
Justify content describes how to align children within the main axis of their container.
|
||||
For example, you can use this property to center a child horizontally within a container
|
||||
with `flex direction` set to `Row` or vertically within a container with `flex direction`
|
||||
set to `Column`.
|
||||
|
||||
**FLEX START (DEFAULT)** Align children of a container to the start of the container's main axis.
|
||||
|
||||
**FLEX END** Align children of a container to the end of the container's main axis.
|
||||
|
||||
**CENTER** Align children of a container in the center of the container's main axis.
|
||||
|
||||
**SPACE BETWEEN** Evenly space of children across the container's main axis, distrubuting
|
||||
remaining space between the children.
|
||||
|
||||
**SPACE AROUND** Evenly space of children across the container's main axis, distrubuting
|
||||
remaining space around the children. Compared to `Space Between` using
|
||||
`Space Around` will result in space being distributed to the begining of
|
||||
the first child and end of the last child.
|
||||
|
||||
<controls prop="justifyContent"></controls>
|
||||
|
@@ -6,27 +6,21 @@ hasPlayground: true
|
||||
|
||||
## Margins, Paddings, and Borders
|
||||
|
||||
### Margin
|
||||
|
||||
Margin effect the spacing around the outside of a node. A node with margin
|
||||
**MARGIN** effects the spacing around the outside of a node. A node with margin
|
||||
will offset itself from the bounds of its parent but also offset the
|
||||
location of any siblings. The margin of a node contributes to the total size
|
||||
of its parent if the parent is auto sized.
|
||||
|
||||
<controls prop="margin"></controls>
|
||||
|
||||
### Padding
|
||||
|
||||
Padding affect the size of the node it is applied to. Padding in Yoga acts as if
|
||||
**PADDING** affects the size of the node it is applied to. Padding in Yoga acts as if
|
||||
`box-sizing: border-box;` was set. That is padding will not add to the total size
|
||||
of an element if it has an explicit size set. For auto sized nodes padding will increase
|
||||
the size of the node as well as offset the location of any children.
|
||||
|
||||
<controls prop="padding"></controls>
|
||||
|
||||
### Border
|
||||
|
||||
Border in Yoga acts exactly like padding and only exists as a seperate property so
|
||||
**BORDER** in Yoga acts exactly like padding and only exists as a seperate property so
|
||||
that higher level frameworks get a hint as to how thick to draw a border. Yoga however
|
||||
does not do any drawing so just uses this information during layout where border
|
||||
acts exactly like padding.
|
||||
|
Reference in New Issue
Block a user