> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# flex-direction

APISummary
## Introduction

The `flex-direction` CSS property sets how flex items are placed in the flex container defining the main axis and the direction.

## Examples

**This is an example below: css-api**

**Entry:** `src/flex-direction`
**Bundle:** `dist/flex-direction.lynx.bundle`

```tsx
import { root } from "@lynx-js/react";
import "./index.scss";

const FlexDirection = () => {
  const greenStyle = {
    backgroundColor: "rgba(0,255,0,0.2)" as const,
    flexGrow: 1,
  };

  const blueStyle = {
    backgroundColor: "rgba(0,0,255,0.2)" as const,
    flexGrow: 1,
  };

  const redStyle = {
    backgroundColor: "rgba(255,0,0,0.2)" as const,
    flexGrow: 1,
  };

  return (
    <scroll-view className="root" scroll-orientation="vertical">
      <view className="fixed_area">
        <view className="row">
          <view style={greenStyle}></view>
          <view style={blueStyle}></view>
          <view style={redStyle}></view>
        </view>

        <view className="row-reverse">
          <view style={greenStyle}></view>
          <view style={blueStyle}></view>
          <view style={redStyle}></view>
        </view>

        <view className="container column">
          <view style={greenStyle}></view>
          <view style={blueStyle}></view>
          <view style={redStyle}></view>
        </view>

        <view className="container column-reverse">
          <view style={greenStyle}></view>
          <view style={blueStyle}></view>
          <view style={redStyle}></view>
        </view>
      </view>
    </scroll-view>
  );
};

root.render(<FlexDirection />);

```

v0.11.0



Note that the values `row` and `row-reverse` are affected by the directionality of the flex container. If its [`dir`](/next/api/css/properties/direction.md) attribute is `ltr`, `row` represents the horizontal axis oriented from the left to the right, and `row-reverse` from the right to the left; if the `dir` attribute is `rtl`, `row` represents the axis oriented from the right to the left, and `row-reverse` from the left to the right.

## Syntax

```css
/* The direction text is laid out in a line */
flex-direction: row;

/* Like <row>, but reversed */
flex-direction: row-reverse;

/* The direction in which lines of text are stacked */
flex-direction: column;

/* Like <column>, but reversed */
flex-direction: column-reverse;
```

### Values

- `row`

  **Default value**. The flex container's main-axis is defined to be the same as the text direction. The main-start and main-end points are the same as the content direction.

- `row-reverse`

  Behaves the same as `row` but the main-start and main-end points are opposite to the content direction.

- `column`

  The flex container's main-axis is the same as the vertical. The main-start and main-end points are the same as the before and after points of the writing-mode.

- `column-reverse`

  Behaves the same as `column` but the main-start and main-end are opposite to the content direction.

## Formal definition

| Initial value | row |
| Applies to | flex containers |
| Inherited | no |
| Animatable |  |


## Formal syntax

```
flex-direction =
  row             |
  row-reverse     |
  column          |
  column-reverse
```

## Compatibility

**Compatibility Table**

**Query:** `css.properties.flex-direction`

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/53-flex-direction.json) · [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| flex-direction | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes (1.0) | Yes |

**`flex-direction`**

**Specifications:**

