# lv_grid.h (/api/layouts/grid/lv_grid_h)



<ApiSummary functions="5" enums="1" macros="3" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (3)&#x22;,&#x22;Other (2)&#x22;]">
  <ApiTab value="Setters (3)">
    <ApiMember kind="function" name="lv_obj_set_grid_dsc_array" file="layouts/grid/lv_grid.h" line="63" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/grid/lv_grid.h#L63">
      lv_obj_set_grid_dsc_array [#lv_obj_set_grid_dsc_array]

      ```c title=" " lineNumbers=1
      void lv_obj_set_grid_dsc_array(lv_obj_t *obj, const int32_t col_dsc[], const int32_t row_dsc[])
      ```

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

      | Name      | Type                                               |
      | --------- | -------------------------------------------------- |
      | `obj`     | <ApiLink name="lv_obj_t" display="lv_obj_t *" />   |
      | `col_dsc` | <ApiLink name="int32_t" display="const int32_t" /> |
      | `row_dsc` | <ApiLink name="int32_t" display="const int32_t" /> |
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_set_grid_align" file="layouts/grid/lv_grid.h" line="65" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/grid/lv_grid.h#L65">
      lv_obj_set_grid_align [#lv_obj_set_grid_align]

      ```c title=" " lineNumbers=1
      void lv_obj_set_grid_align(lv_obj_t *obj, lv_grid_align_t column_align, lv_grid_align_t row_align)
      ```

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

      | Name           | Type                                             |
      | -------------- | ------------------------------------------------ |
      | `obj`          | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> |
      | `column_align` | <ApiLink name="lv_grid_align_t" />               |
      | `row_align`    | <ApiLink name="lv_grid_align_t" />               |
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_set_grid_cell" file="layouts/grid/lv_grid.h" line="77" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/grid/lv_grid.h#L77">
      lv_obj_set_grid_cell [#lv_obj_set_grid_cell]

      Set the cell of an object. The object's parent needs to have grid layout, else nothing will happen

      ```c title=" " lineNumbers=1
      void lv_obj_set_grid_cell(lv_obj_t *obj, lv_grid_align_t column_align, int32_t col_pos, int32_t col_span, lv_grid_align_t row_align, int32_t row_pos, int32_t row_span)
      ```

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

      | Name           | Type                                             | Description                                                              |
      | -------------- | ------------------------------------------------ | ------------------------------------------------------------------------ |
      | `obj`          | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object                                                     |
      | `column_align` | <ApiLink name="lv_grid_align_t" />               | the vertical alignment in the cell. `LV_GRID_START/END/CENTER/STRETCH`   |
      | `col_pos`      | <ApiLink name="int32_t" />                       | column ID                                                                |
      | `col_span`     | <ApiLink name="int32_t" />                       | number of columns to take (>= 1)                                         |
      | `row_align`    | <ApiLink name="lv_grid_align_t" />               | the horizontal alignment in the cell. `LV_GRID_START/END/CENTER/STRETCH` |
      | `row_pos`      | <ApiLink name="int32_t" />                       | row ID                                                                   |
      | `row_span`     | <ApiLink name="int32_t" />                       | number of rows to take (>= 1)                                            |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (2)">
    <ApiMember kind="function" name="lv_grid_init" file="layouts/grid/lv_grid.h" line="61" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/grid/lv_grid.h#L61">
      lv_grid_init [#lv_grid_init]

      ```c title=" " lineNumbers=1
      void lv_grid_init(void)
      ```
    </ApiMember>

    <ApiMember kind="function" name="lv_grid_fr" file="layouts/grid/lv_grid.h" line="83" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/grid/lv_grid.h#L83">
      lv_grid_fr [#lv_grid_fr]

      Just a wrapper to `LV_GRID_FR` for bindings.

      ```c title=" " lineNumbers=1
      int32_t lv_grid_fr(uint8_t x)
      ```

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

      | Name | Type                       |
      | ---- | -------------------------- |
      | `x`  | <ApiLink name="uint8_t" /> |
    </ApiMember>
  </ApiTab>
</ApiTabs>

Enums [#enums]

<ApiMember kind="enum" name="lv_grid_align_t" file="layouts/grid/lv_grid.h" line="43" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/grid/lv_grid.h#L43">
  lv_grid_align_t [#lv_grid_align_t]

  | Name                          |
  | ----------------------------- |
  | `LV_GRID_ALIGN_START`         |
  | `LV_GRID_ALIGN_CENTER`        |
  | `LV_GRID_ALIGN_END`           |
  | `LV_GRID_ALIGN_STRETCH`       |
  | `LV_GRID_ALIGN_SPACE_EVENLY`  |
  | `LV_GRID_ALIGN_SPACE_AROUND`  |
  | `LV_GRID_ALIGN_SPACE_BETWEEN` |
</ApiMember>

<TypeUsedBy name="lv_grid_align_t" count="12">
  * `lv_obj_set_style_grid_column_align` — param `value`
  * `lv_obj_set_style_grid_row_align` — param `value`
  * `lv_obj_set_style_grid_cell_x_align` — param `value`
  * `lv_obj_set_style_grid_cell_y_align` — param `value`
  * `lv_obj_set_grid_align` — param `column_align`
  * `lv_obj_set_grid_align` — param `row_align`
  * `lv_obj_set_grid_cell` — param `column_align`
  * `lv_obj_set_grid_cell` — param `row_align`
  * `lv_style_set_grid_column_align` — param `value`
  * `lv_style_set_grid_row_align` — param `value`
  * `lv_style_set_grid_cell_x_align` — param `value`
  * `lv_style_set_grid_cell_y_align` — param `value`
</TypeUsedBy>

Macros [#macros]

<ApiMember kind="macro" name="LV_GRID_FR" file="layouts/grid/lv_grid.h" line="29" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/grid/lv_grid.h#L29">
  LV_GRID_FR [#lv_grid_fr-1]

  ```c title=" " lineNumbers=1
  #define LV_GRID_FR(x) \
      (LV_COORD_MAX - 100 + x)
  ```

  Can be used track size to make the track fill the free space.

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

  | Name | Description                                              |
  | ---- | -------------------------------------------------------- |
  | `x`  | how much space to take proportionally to other FR tracks |

  **Returns:** a special track size
</ApiMember>

<ApiMember kind="macro" name="LV_GRID_CONTENT" file="layouts/grid/lv_grid.h" line="31" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/grid/lv_grid.h#L31">
  LV_GRID_CONTENT [#lv_grid_content]

  ```c title=" " lineNumbers=1
  #define LV_GRID_CONTENT (LV_COORD_MAX - 101)
  ```
</ApiMember>

<ApiMember kind="macro" name="LV_GRID_TEMPLATE_LAST" file="layouts/grid/lv_grid.h" line="34" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/layouts/grid/lv_grid.h#L34">
  LV_GRID_TEMPLATE_LAST [#lv_grid_template_last]

  ```c title=" " lineNumbers=1
  #define LV_GRID_TEMPLATE_LAST (LV_COORD_MAX)
  ```
</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;]" />
