Skip to content

Commit

Permalink
Update index.rst (#3645)
Browse files Browse the repository at this point in the history
Explanation for how to check if the select has a specific value selected. This is very difficult to find/deduce from the documentation.
  • Loading branch information
Zynth-dev authored Feb 27, 2024
1 parent b8e58d4 commit a49bc01
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/select/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@ advanced stuff (see the full API Reference for more info).
auto state = id(my_select).state.c_str();
ESP_LOGI("main", "Option of my select: %s", state);
.. code-block:: yaml
# Check if a specific option is selected
- if:
condition:
- lambda: 'return id(my_select).state == "my_option_value";'
- ``.size()``: Retrieve the number of options in the select.

.. code-block:: cpp
Expand Down

0 comments on commit a49bc01

Please sign in to comment.