Main Options¶
| Name | JS | Type | Default | Supported options | Description |
|---|---|---|---|---|---|
type |
string | Required | custom:button-card |
Type of the card | |
template |
string | optional | any valid template from button_card_templates |
See configuration template | |
entity |
(init only) |
string | optional | switch.ac |
entity_id |
section_mode |
boolean | optional | true | false |
Set it to true when the card is used in a sections view. See Sections views |
|
triggers_update |
(init only) |
string or array | optional | switch.ac |
entity_id list that would trigger a card update, see triggers_update |
group_expand |
boolean | false | true | false |
When true, if any of the entities triggering a card update is a group, it will auto-expand the group and the card will update on any child entity state change. This works with nested groups too. See triggers_update |
|
update_timer |
number or string | optional | number >= 100 (ms), string duration in english supported by helpers.parseDuration >= 100 (ms) |
Set to a duration greater than or equal to 100ms to update the card at this refresh rate. This should only be used when the card has no entity and there is no appropriate triggers_update strategy. The template is evaluated on each refresh of the card, be it from the update_timer timeout or trigger update. To maintan dashboard compatability when user locale changes, the duration must be specified in english locale. |
|
icon |
string | optional | mdi:air-conditioner |
Icon to display. Will be overridden by the icon defined in a state (if present). Defaults to the entity icon. Hide with show_icon: false. |
|
name |
string | optional | Air conditioner |
Define an optional text to show below the icon. | |
state_display |
string | optional | On |
Override the way the state is displayed. | |
label |
string | optional | Any string that you want | Display a label below the card. See Layouts for more information. | |
show_name |
boolean | true |
true | false |
Wether to show the name or not. Will pick entity_id's name by default, unless redefined in the name property or in any state name property |
|
show_state |
boolean | false |
true | false |
Show the state on the card. defaults to false if not set | |
numeric_precision |
number | none | any number | Force the display precision of the state to be with numeric_precision decimals |
|
show_icon |
boolean | true |
true | false |
Wether to show the icon or not. Unless redefined in icon, uses the default entity icon from hass |
|
show_units |
boolean | true |
true | false |
Display or hide the units of a sensor, if any. | |
show_label |
boolean | false |
true | false |
Display or hide the label |
|
show_last_changed |
boolean | false |
true | false |
Replace the label altogether and display the the last_changed attribute in a nice way (eg: 12 minutes ago) |
|
show_ripple |
boolean | optional | true or false |
If defined, this will enable or disable the ripple/hover effect on the card. If undefined, the ripple/hover effect is automatically enabled if the card has at least an action defined (including the default one based on the entity). | |
show_entity_picture |
boolean | false |
true | false |
Replace the icon by the entity picture (if any) or the custom picture (if any). Falls back to using the icon if both are undefined | |
show_live_stream |
boolean | false |
true | false |
Display the camera stream (if the entity is a camera). Requires the stream: component to be enabled in home-assistant's config |
|
live_stream_aspect_ratio |
string | optional | 16x9, 50%, 1.78 ... |
See home-assistant Picture Entity card aspect_ratio for valid options | |
live_stream_fit_mode |
string | optional | cover, contain, fill |
See home-assistant Picture Entity card fit_mod for information on how each option works | |
entity_picture |
string | optional | Can be any of /local/* file or a URL |
Will override the icon/the default entity_picture with your own image. Best is to use a square image. You can also define one per state. | |
units |
string | optional | Kb/s, lux, ... |
Override or define the units to display after the state of the entity. If omitted, it's using the entity's units | |
color_type |
string | icon |
icon | card | blank-card | label-card |
Color either the background of the card or the icon inside the card. Setting this to card enable automatic font and icon color. This allows the text/icon to be readable even if the background color is bright/dark. Additional color-type options blank-card and label-card can be used for organisation (see examples). |
|
color |
string | optional | auto | auto-no-temperature | rgb(28, 128, 199) |
Color of the icon/card. auto sets the color based on the color of a light including the temperature of the light. Setting this to auto-no-temperature will behave like home-assistant's default, ignoring the temperature of the light. By default, if the entity state is off, the color will be var(--state-inactive-color) for icon and var (--card-background-color) for card, for on it will be var(--state-active-color) and for any other state it will be var(--primary-text-color). You can redefine each colors using state |
|
size |
string | 40% |
20px |
Size of the icon. Can be percentage or pixel | |
aspect_ratio |
string | optional | 1/1, 2/1, 1/1.5, ... |
See Aspect Ratio for an example. Aspect ratio of the card. 1/1 being a square. This will auto adapt to your screen size |
|
tap_action |
object | optional | See Action | Define the type of action on click, if undefined, toggle will be used for domains that support toggle, or button press for input_button. | |
hold_action |
object | optional | See Action | Define the type of action on hold, if undefined, nothing happens. | |
double_tap_action |
object | optional | See Action | Define the type of action on double click, if undefined, nothing happens. | |
press_action |
object | optional | See Action | Define the type of action to execute immediately on button press. If defined, the only other card action allowed is release_action |
|
release_action |
object | optional | See Action | Define the type of action to execute on button release. If defined, the only other card action allowed is press_action |
|
icon_tap_action |
object | optional | See Action | Define the type of action on icon click, if undefined, nothing happens. When configured, the icon becomes clickable separately from the card. See note in icon_*_action | |
icon_hold_action |
object | optional | See Action | Define the type of action on icon hold, if undefined, nothing happens. When configured, the icon becomes holdable separately from the card. See note in icon_*_action | |
icon_double_tap_action |
object | optional | See Action | Define the type of action on icon double click, if undefined, nothing happens. When configured, the icon becomes double-clickable separately from the card. See note in icon_*_action | |
icon_press_action |
object | optional | See Action | Define the type of action to execute immediately on icon press. If defined, the only other icon action allowed is icon_release_action. See note in icon_*_action |
|
icon_release_action |
object | optional | See Action | Define the type of action to execute on icon release. If defined, the only other icon action allowed is icon_press_action. See note in icon_*_action |
|
styles |
object list | optional | See styles | ||
extra_styles |
string | optional | See styles | ||
state |
object list | optional | See State | State to use for the color, icon and style of the button. Multiple states can be defined | |
confirmation |
object | optional | See confirmation | Display a confirmation popup | |
lock |
object | optional | See Lock Object | Displays a lock on the button | |
layout |
string | optional | See Layout | The layout of the button can be modified using this option | |
custom_fields |
object | optional | See Custom Fields | ||
variables |
object | optional | See Variables | ||
card_size |
number | 3 | Any number | Configure the card size seen by the auto layout feature of lovelace (lovelace will multiply the value by about 50px) | |
tooltip |
string or object | optional | See Tooltips | Display a tooltip. (Not supported on touchscreens). | |
hidden |
boolean | optional | false |
Shows or hides the card. Supports templates. | |
disable_kbd |
boolean | false |
true or false |
Disable keyboard enter and space capture on the button itself. Usefull when you have input fields inside the button. |
|
spinner |
boolean | false |
true or false |
See spinner. If true, it will lock the card and display a spinner. You'll need to use a template or state to make this variable. |
|
protect |
object | none | See protect | Display a password or PIN confirmation popup. |