Update popup design. Add form popups
This commit is contained in:
@@ -10,16 +10,38 @@ data:
|
||||
left_button: Left button
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
## Displaying a dashboard card in a popup
|
||||
## Size
|
||||
|
||||
The `size` parameter can be set to `normal`, `wide` and `fullscreen` with results as below (background blur has been exagerated for clarity):
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
## HTML content
|
||||
|
||||
```yaml
|
||||
service: browser_mod.popup
|
||||
data:
|
||||
title: The title
|
||||
right_button: Right button
|
||||
left_button: Left button
|
||||
title: HTML content
|
||||
content: |
|
||||
An <b>HTML</b> string.
|
||||
<p> Pretty much any HTML works: <ha-icon icon="mdi:lamp" style="color: red;"></ha-icon>
|
||||
```
|
||||
|
||||

|
||||
|
||||
## Dashboard card content
|
||||
|
||||
```yaml
|
||||
service: browser_mod.popup
|
||||
data:
|
||||
title: HTML content
|
||||
content:
|
||||
type: entities
|
||||
entities:
|
||||
@@ -28,10 +50,53 @@ data:
|
||||
- light.kitchen_lights
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
## Form content
|
||||
`content` can be a list of ha-form schemas and the popup will then contain a form for user input:
|
||||
|
||||
```
|
||||
<ha-form schema>:
|
||||
name: <string>
|
||||
[label: <string>]
|
||||
[default: <any>]
|
||||
selector: <Home Assistant Selector>
|
||||
```
|
||||
|
||||
| | |
|
||||
|-|-|
|
||||
| `name` | A unique parameter name |
|
||||
| `label` | A description of the parameter |
|
||||
| `default` | The default value for the parameter |
|
||||
| `selector` | A [Home Assistant selector](https://www.home-assistant.io/docs/blueprint/selectors) |
|
||||
|
||||
The data from the form will be forwarded as data for any `right_button_action` or `left_button_action` of the popup.
|
||||
|
||||
```yaml
|
||||
service: browser_mod.popup
|
||||
data:
|
||||
title: Form content
|
||||
content:
|
||||
- name: parameter_name
|
||||
label: Descriptive name
|
||||
selector:
|
||||
text: null
|
||||
- name: another_parameter
|
||||
label: A number
|
||||
default: 5
|
||||
selector:
|
||||
number:
|
||||
min: 0
|
||||
max: 10
|
||||
slider: true
|
||||
```
|
||||
|
||||

|
||||
|
||||
## Actionable popups
|
||||
|
||||
Example of a popup with actions opening more popups or calling Home Assistant services:
|
||||
|
||||
```yaml
|
||||
service: browser_mod.popup
|
||||
data:
|
||||
@@ -62,4 +127,35 @@ data:
|
||||
entity_id: light.bed_light
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
## Forward form data
|
||||
|
||||
The following popup would ask the user for a list of rooms to vacuum and then populate the `params` parameter of the `vacuum.send_command` service call from the result:
|
||||
|
||||
```yaml
|
||||
service: browser_mod.popup
|
||||
data:
|
||||
title: Where to vacuum?
|
||||
right_button: Go!
|
||||
right_button_action:
|
||||
service: vacuum.send_command
|
||||
data:
|
||||
entity_id: vacuum.xiaomi
|
||||
command: app_segment_clean
|
||||
content:
|
||||
- name: params
|
||||
label: Rooms to clean
|
||||
selector:
|
||||
select:
|
||||
multiple: true
|
||||
options:
|
||||
- label: Kitchen
|
||||
value: 11
|
||||
- label: Living room
|
||||
value: 13
|
||||
- label: Bedroom
|
||||
value: 12
|
||||
```
|
||||
|
||||

|
||||
Reference in New Issue
Block a user