Custom Element developers can now create Custom View Layouts that users can load and use!
In 0.116, we will be changing the way that we create Views in Lovelace. In the past, we had 2 views, a default view and a panel view. When talking about adding Drag and Drop to Lovelace, we decided we could do even better and start allowing custom view types.
Custom Developers will now be able to create a view that receives the following properties:
Cards and Badges will be created and maintained by the core code and given to the custom view. The custom views are meant to load the cards and badges and display them in a customized layout.
Here is an example below: (note: this example does not have all of the properties but the necessities to show the example)
And you can define this element in the Custom Element Registry just as you would with a Custom Card:
You can find an example of this in our default view:
Masonry View Located here: frontend/src/panels/lovelace/views/hui-masonry-view.ts
A user who downloads and installs your new Custom View can then use it via editing the YAML configuration of their view to be:
Custom Developers can add a
layout property to each card that can store a key, position info, width, height, etc:
For Custom Card developers that use something like this:
You will no longer be able to use the
hui-view element to retrieve LitElement as it has been changed to be an
updatingElement. Instead you can use:
But Note! This is not supported by HA. In the future, this may not work to import LitElement.