mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-19 15:26:29 +00:00
Blog country selector (#1948)
This commit is contained in:
parent
204966dba4
commit
010521af68
23
blog/2023-10-12-country_selector.md
Normal file
23
blog/2023-10-12-country_selector.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
author: G Johansson
|
||||||
|
authorURL: https://github.com/gjohansson-ST
|
||||||
|
title: "Country selector"
|
||||||
|
---
|
||||||
|
|
||||||
|
[Selectors](https://www.home-assistant.io/docs/blueprint/selectors/) has been expanded and now also includes a `CountrySelector`.
|
||||||
|
|
||||||
|
Using this in [config flows](/docs/data_entry_flow_index#show-form) will allow frontend to automatically translate the country codes into the proper country names.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
vol.Schema(
|
||||||
|
{
|
||||||
|
vol.Optional(CONF_COUNTRY): CountrySelector(
|
||||||
|
CountrySelectorConfig(
|
||||||
|
countries=["DE", "US"],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
```
|
Loading…
x
Reference in New Issue
Block a user