Custom View Layouts allow developers and users to customize the way that Cards and Badges are displayed in a view by loading the layout and specifying the type on the view. You are now not limited to our built-in sorting methods.
You define your custom view as a custom element. It's up to you to decide how to render your DOM inside your element. You can use Lit Element, Preact, or any other popular framework (except for React – more info on React here).
Custom Views receive the following:
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.
(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:
If your view requires data to persist at a card level, there is a
layout in the card configuration that can be used to store information. Example: Key, X and Y coordinates, width and height, etc. This can be useful when you need to store the location or dimensions of a card for your view.