2024-03-08 14:13:55 -08:00
|
|
|
---
|
|
|
|
sidebar_position: 6
|
|
|
|
---
|
|
|
|
|
2024-03-12 11:31:46 -07:00
|
|
|
import Playground from '@site/src/components/Playground';
|
|
|
|
|
2024-03-08 14:13:55 -08:00
|
|
|
# Flex Direction
|
2024-03-12 11:31:46 -07:00
|
|
|
|
|
|
|
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 is the axis perpendicular to the
|
|
|
|
main axis, or the axis which wrapping lines are laid out in.
|
|
|
|
|
2024-03-12 15:17:57 -07:00
|
|
|
**Column (default)**: Align children from top to bottom. If [wrapping](/docs/styling/flex-wrap) is enabled then
|
2024-03-12 11:31:46 -07:00
|
|
|
the next line will start to the left first item on the top of the container.
|
|
|
|
|
2024-03-12 15:17:57 -07:00
|
|
|
**Row**: Align children from left to right. If [wrapping](/docs/styling/flex-wrap) is enabled then
|
2024-03-12 11:31:46 -07:00
|
|
|
the next line will start under the first item on the left of the container.
|
|
|
|
|
2024-03-12 15:17:57 -07:00
|
|
|
**Row reverse**: Align children from right to left. If [wrapping](/docs/styling/flex-wrap) is enabled then
|
2024-03-12 11:31:46 -07:00
|
|
|
the next line will start under the first item on the right of the container.
|
|
|
|
|
2024-03-12 15:17:57 -07:00
|
|
|
**Column reverse**: Align children from bottom to top. If [wrapping](/docs/styling/flex-wrap) is enabled then
|
2024-03-12 11:31:46 -07:00
|
|
|
the next line will start to the left first item on the bottom of the container.
|
|
|
|
|
|
|
|
<Playground code={`<Layout config={{useWebDefaults: false}}>
|
|
|
|
<Node
|
|
|
|
style={{
|
|
|
|
width: 200,
|
|
|
|
height: 200,
|
2024-03-12 11:31:46 -07:00
|
|
|
padding: 10,
|
2024-03-13 10:19:30 -07:00
|
|
|
flexDirection: 'column',
|
2024-03-12 11:31:46 -07:00
|
|
|
}}>
|
|
|
|
<Node style={{margin: 5, height: 50, width: 50}} />
|
|
|
|
<Node style={{margin: 5, height: 50, width: 50}} />
|
|
|
|
</Node>
|
|
|
|
</Layout>`} />
|