# lv_checkbox.h (/api/public/widgets/lv_checkbox_h)



<RelatedHeaders name="lv_checkbox_private.h" isPrivate="false" />

<ApiSummary functions="4" enums="1" variables="1" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (2)&#x22;,&#x22;Getters (1)&#x22;,&#x22;Other (1)&#x22;]">
  <ApiTab value="Setters (2)">
    <ApiMember kind="function" name="lv_checkbox_set_text" file="public/widgets/lv_checkbox.h" line="56" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_checkbox.h#L56">
      lv_checkbox_set_text [#lv_checkbox_set_text]

      Set the text of a check box. `txt` will be copied and may be deallocated after this function returns.

      ```c title=" " lineNumbers=1
      void lv_checkbox_set_text(lv_obj_t *obj, const char *txt)
      ```

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

      | Name  | Type                                             | Description                                                                           |
      | ----- | ------------------------------------------------ | ------------------------------------------------------------------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a check box                                                                |
      | `txt` | `const char *`                                   | the text of the check box. **May** be `NULL`. When NULL the widget is only refreshed. |
    </ApiMember>

    <ApiMember kind="function" name="lv_checkbox_set_text_static" file="public/widgets/lv_checkbox.h" line="64" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_checkbox.h#L64">
      lv_checkbox_set_text_static [#lv_checkbox_set_text_static]

      Set the text of a check box. `txt` must not be deallocated during the life of this checkbox.

      ```c title=" " lineNumbers=1
      void lv_checkbox_set_text_static(lv_obj_t *obj, const char *txt)
      ```

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

      | Name  | Type                                             | Description                |
      | ----- | ------------------------------------------------ | -------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a check box     |
      | `txt` | `const char *`                                   | the text of the check box. |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Getters (1)">
    <ApiMember kind="function" name="lv_checkbox_get_text" file="public/widgets/lv_checkbox.h" line="75" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_checkbox.h#L75">
      lv_checkbox_get_text [#lv_checkbox_get_text]

      Get the text of a check box

      ```c title=" " lineNumbers=1
      const char * lv_checkbox_get_text(const lv_obj_t *obj)
      ```

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

      | Name  | Type                                                   | Description                 |
      | ----- | ------------------------------------------------------ | --------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to check box object |

      **Returns:** `const char *` — pointer to the text of the check box
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (1)">
    <ApiMember kind="function" name="lv_checkbox_create" file="public/widgets/lv_checkbox.h" line="44" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_checkbox.h#L44">
      lv_checkbox_create [#lv_checkbox_create]

      Create a check box object

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_checkbox_create(lv_obj_t *parent)
      ```

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

      | Name     | Type                                             | Description                                                                                                         |
      | -------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
      | `parent` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a parent widget **May** be `NULL`.. When NULL, the widget is created as a screen on the default display. |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer to the created check box
    </ApiMember>
  </ApiTab>
</ApiTabs>

Enums [#enums]

<ApiMember kind="enum" name="_lv_property_checkbox_id_t" file="public/widgets/lv_checkbox.h" line="28" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_checkbox.h#L28">
  \_lv_property_checkbox_id_t [#_lv_property_checkbox_id_t]

  | Name                        | Value                                                             |
  | --------------------------- | ----------------------------------------------------------------- |
  | `LV_PROPERTY_CHECKBOX_TEXT` | `(LV_PROPERTY_CHECKBOX_START + ((int) 0 )) \| ((  7   ) <<  28 )` |
  | `LV_PROPERTY_CHECKBOX_END`  |                                                                   |
</ApiMember>

Variables [#variables]

<ApiMember kind="variable" name="lv_checkbox_class" file="public/widgets/lv_checkbox.h" line="25" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_checkbox.h#L25">
  lv_checkbox_class [#lv_checkbox_class]

  ```c title=" " lineNumbers=1
  const lv_obj_class_t lv_checkbox_class
  ```
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_conf_internal.h&#x22;, &#x22;lv_obj.h&#x22;]" includedBy="[&#x22;lvgl.h&#x22;]" transitiveIncludes="[&#x22;lv_anim.h&#x22;, &#x22;lv_area.h&#x22;, &#x22;lv_assert.h&#x22;, &#x22;lv_bidi.h&#x22;, &#x22;lv_color.h&#x22;, &#x22;lv_color_op.h&#x22;, &#x22;lv_display.h&#x22;, &#x22;lv_draw.h&#x22;, &#x22;lv_draw_arc.h&#x22;, &#x22;lv_draw_blur.h&#x22;, &#x22;lv_draw_buf.h&#x22;, &#x22;lv_draw_image.h&#x22;, &#x22;lv_draw_label.h&#x22;, &#x22;lv_draw_line.h&#x22;, &#x22;lv_draw_rect.h&#x22;, &#x22;lv_draw_triangle.h&#x22;, &#x22;lv_event.h&#x22;, &#x22;lv_ext_data.h&#x22;, &#x22;lv_flex.h&#x22;, &#x22;lv_font.h&#x22;, &#x22;lv_fs.h&#x22;, &#x22;lv_grad.h&#x22;, &#x22;lv_grid.h&#x22;, &#x22;lv_group.h&#x22;, &#x22;lv_image_decoder.h&#x22;, &#x22;lv_image_dsc.h&#x22;, &#x22;lv_indev.h&#x22;, &#x22;lv_layout.h&#x22;, &#x22;lv_log.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_matrix.h&#x22;, &#x22;lv_mem.h&#x22;, &#x22;lv_obj_class.h&#x22;, &#x22;lv_obj_draw.h&#x22;, &#x22;lv_obj_event.h&#x22;, &#x22;lv_obj_pos.h&#x22;, &#x22;lv_obj_property.h&#x22;, &#x22;lv_obj_scroll.h&#x22;, &#x22;lv_obj_style.h&#x22;, &#x22;lv_obj_style_gen.h&#x22;, &#x22;lv_obj_tree.h&#x22;, &#x22;lv_palette.h&#x22;, &#x22;lv_profiler.h&#x22;, &#x22;lv_profiler_builtin.h&#x22;, &#x22;lv_sprintf.h&#x22;, &#x22;lv_string.h&#x22;, &#x22;lv_style.h&#x22;, &#x22;lv_style_gen.h&#x22;, &#x22;lv_symbol_def.h&#x22;, &#x22;lv_text.h&#x22;, &#x22;lv_timer.h&#x22;, &#x22;lv_types.h&#x22;]" />
