Add new Events to Custom View Docs (#746)

This commit is contained in:
Zack Barett 2020-12-07 06:54:03 -06:00 committed by GitHub
parent 16a9187f58
commit 53e5f10c6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,3 +73,25 @@ If your view requires data to persist at a card level, there is a `layout` in th
width: 54px
entity: weather.my_weather
```
## Edit, Delete, or Add a Card
To call the core frontend dialogs to edit, delete or add a card, you can simply call these three events:
```
Event: "ll-delete-card"
Detail: { path: [number] | [number, number] }
Event: "ll-edit-card"
Detail: { path: [number] | [number, number] }
Event: "ll-add-card"
Detail: none
```
To call an event, you can use:
```js
// Delete 4th card in the current view
this.dispatchEvent(new Event("ll-edit-card", { detail: { path: [3] } })) // this refers to the card element
```