# lv_flex.h (/api/layouts/flex/lv_flex_h)



<ApiSummary functions="4" enums="2" macros="3" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (3)&#x22;,&#x22;Other (1)&#x22;]">
  <ApiTab value="Setters (3)">
    <ApiMember kind="function" name="lv_obj_set_flex_flow" file="layouts/flex/lv_flex.h" line="73" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/flex/lv_flex.h#L73">
      lv_obj_set_flex_flow [#lv_obj_set_flex_flow]

      Set how the item should flow

      ```c title=" " lineNumbers=1
      void lv_obj_set_flex_flow(lv_obj_t *obj, lv_flex_flow_t flow)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                                             | Description                                                                      |
      | ------ | ------------------------------------------------ | -------------------------------------------------------------------------------- |
      | `obj`  | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object. The parent must have flex layout else nothing will happen. |
      | `flow` | <ApiLink name="lv_flex_flow_t" />                | an element of `lv_flex_flow_t`.                                                  |
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_set_flex_align" file="layouts/flex/lv_flex.h" line="82" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/flex/lv_flex.h#L82">
      lv_obj_set_flex_align [#lv_obj_set_flex_align]

      Set how to place (where to align) the items and tracks

      ```c title=" " lineNumbers=1
      void lv_obj_set_flex_align(lv_obj_t *obj, lv_flex_align_t main_place, lv_flex_align_t cross_place, lv_flex_align_t track_cross_place)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name                | Type                                             | Description                                                                                |
      | ------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------ |
      | `obj`               | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object. The parent must have flex layout else nothing will happen.           |
      | `main_place`        | <ApiLink name="lv_flex_align_t" />               | where to place the items on main axis (in their track). Any value of `lv_flex_align_t`.    |
      | `cross_place`       | <ApiLink name="lv_flex_align_t" />               | where to place the item in their track on the cross axis. `LV_FLEX_ALIGN_START/END/CENTER` |
      | `track_cross_place` | <ApiLink name="lv_flex_align_t" />               | where to place the tracks in the cross direction. Any value of `lv_flex_align_t`.          |
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_set_flex_grow" file="layouts/flex/lv_flex.h" line="90" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/flex/lv_flex.h#L90">
      lv_obj_set_flex_grow [#lv_obj_set_flex_grow]

      Sets the width or height (on main axis) to grow the object in order fill the free space

      ```c title=" " lineNumbers=1
      void lv_obj_set_flex_grow(lv_obj_t *obj, uint8_t grow)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                                             | Description                                                                       |
      | ------ | ------------------------------------------------ | --------------------------------------------------------------------------------- |
      | `obj`  | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object. The parent must have flex layout else nothing will happen.  |
      | `grow` | <ApiLink name="uint8_t" />                       | a value to set how much free space to take proportionally to other growing items. |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (1)">
    <ApiMember kind="function" name="lv_flex_init" file="layouts/flex/lv_flex.h" line="66" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/flex/lv_flex.h#L66">
      lv_flex_init [#lv_flex_init]

      Initialize a flex layout to default values

      ```c title=" " lineNumbers=1
      void lv_flex_init(void)
      ```
    </ApiMember>
  </ApiTab>
</ApiTabs>

Enums [#enums]

<ApiMember kind="enum" name="lv_flex_align_t" file="layouts/flex/lv_flex.h" line="35" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/flex/lv_flex.h#L35">
  lv_flex_align_t [#lv_flex_align_t]

  | Name                          |
  | ----------------------------- |
  | `LV_FLEX_ALIGN_START`         |
  | `LV_FLEX_ALIGN_END`           |
  | `LV_FLEX_ALIGN_CENTER`        |
  | `LV_FLEX_ALIGN_SPACE_EVENLY`  |
  | `LV_FLEX_ALIGN_SPACE_AROUND`  |
  | `LV_FLEX_ALIGN_SPACE_BETWEEN` |
</ApiMember>

<TypeUsedBy name="lv_flex_align_t" count="9">
  * `lv_obj_set_style_flex_main_place` — param `value`
  * `lv_obj_set_style_flex_cross_place` — param `value`
  * `lv_obj_set_style_flex_track_place` — param `value`
  * `lv_obj_set_flex_align` — param `main_place`
  * `lv_obj_set_flex_align` — param `cross_place`
  * `lv_obj_set_flex_align` — param `track_cross_place`
  * `lv_style_set_flex_main_place` — param `value`
  * `lv_style_set_flex_cross_place` — param `value`
  * `lv_style_set_flex_track_place` — param `value`
</TypeUsedBy>

<ApiMember kind="enum" name="lv_flex_flow_t" file="layouts/flex/lv_flex.h" line="44" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/flex/lv_flex.h#L44">
  lv_flex_flow_t [#lv_flex_flow_t]

  | Name                               | Value                                            |
  | ---------------------------------- | ------------------------------------------------ |
  | `LV_FLEX_FLOW_ROW`                 | `0x00`                                           |
  | `LV_FLEX_FLOW_COLUMN`              | `(1 << 0)`                                       |
  | `LV_FLEX_FLOW_ROW_WRAP`            | `LV_FLEX_FLOW_ROW \|  (1 << 2)`                  |
  | `LV_FLEX_FLOW_ROW_REVERSE`         | `LV_FLEX_FLOW_ROW \|  (1 << 3)`                  |
  | `LV_FLEX_FLOW_ROW_WRAP_REVERSE`    | `LV_FLEX_FLOW_ROW \|  (1 << 2)  \|  (1 << 3)`    |
  | `LV_FLEX_FLOW_COLUMN_WRAP`         | `LV_FLEX_FLOW_COLUMN \|  (1 << 2)`               |
  | `LV_FLEX_FLOW_COLUMN_REVERSE`      | `LV_FLEX_FLOW_COLUMN \|  (1 << 3)`               |
  | `LV_FLEX_FLOW_COLUMN_WRAP_REVERSE` | `LV_FLEX_FLOW_COLUMN \|  (1 << 2)  \|  (1 << 3)` |
</ApiMember>

<TypeUsedBy name="lv_flex_flow_t" count="3">
  * `lv_obj_set_style_flex_flow` — param `value`
  * `lv_obj_set_flex_flow` — param `flow`
  * `lv_style_set_flex_flow` — param `value`
</TypeUsedBy>

Macros [#macros]

<ApiMember kind="macro" name="LV_FLEX_COLUMN" file="layouts/flex/lv_flex.h" line="25" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/flex/lv_flex.h#L25">
  LV_FLEX_COLUMN [#lv_flex_column]

  ```c title=" " lineNumbers=1
  #define LV_FLEX_COLUMN (1 << 0)
  ```
</ApiMember>

<ApiMember kind="macro" name="LV_FLEX_WRAP" file="layouts/flex/lv_flex.h" line="26" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/flex/lv_flex.h#L26">
  LV_FLEX_WRAP [#lv_flex_wrap]

  ```c title=" " lineNumbers=1
  #define LV_FLEX_WRAP (1 << 2)
  ```
</ApiMember>

<ApiMember kind="macro" name="LV_FLEX_REVERSE" file="layouts/flex/lv_flex.h" line="27" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/flex/lv_flex.h#L27">
  LV_FLEX_REVERSE [#lv_flex_reverse]

  ```c title=" " lineNumbers=1
  #define LV_FLEX_REVERSE (1 << 3)
  ```
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_conf_internal.h&#x22;, &#x22;lv_area.h&#x22;]" includedBy="[&#x22;lv_layout.h&#x22;]" transitiveIncludes="[&#x22;lv_conf_kconfig.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_types.h&#x22;]" />
