You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
configurable:true, // Optional - defaults to false
102
113
});
103
114
```
104
115
116
+
## Context
117
+
118
+
A card feature is rendered inside a card and receives the same context the card is bound to. This is passed both to the element as the `context` property and as the second argument of the `isSupported` function.
119
+
120
+
The `context` object exposes:
121
+
122
+
- `entity_id` _(optional)_: the entity id from the parent card.
123
+
- `area_id` _(optional)_: the area id from the parent card.
124
+
105
125
If you want your feature to better integrate with the default design of home assistant, you can use these CSS variables:
106
126
107
127
- `--feature-height`: Recommended height (42px).
@@ -111,6 +131,6 @@ If you want your feature to better integrate with the default design of home ass
111
131
The main difference with custom cards is the graphical configuration option.
112
132
To have it displayed in the card editor, you must add an object describing it to the array `window.customCardFeatures`.
113
133
114
-
Required properties of the object are `type` and `name`. It is recommended to define the `supported` option with a function, so the editor can only propose the feature if it is compatible with the selected entity in the card. Set `configurable` to `true` if your entity has additional configuration (e.g. `label` option in the example above) so the editor.
134
+
Required properties of the object are `type` and `name`. It is recommended to define the `isSupported` option with a function`(hass, context) => boolean`, so the editor can only propose the feature if it is compatible with the selected entity in the card. Set `configurable` to `true` if your entity has additional configuration (e.g. `label` option in the example above).
115
135
116
136
Also, the static functions `getConfigElement` and `getStubConfig` work the same as with normal custom cards.
0 commit comments