From 4a417a16f422f0a5e172f303e54545668b3d3c24 Mon Sep 17 00:00:00 2001 From: Cadi <64062738+cadihowley@users.noreply.github.com> Date: Sat, 21 Nov 2020 06:45:46 +1300 Subject: [PATCH] Update Button card documentation (#13807) Co-authored-by: Zack Barett Co-authored-by: Zack Barett Co-authored-by: Franck Nijhof --- source/_lovelace/button.markdown | 73 ++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 23 deletions(-) diff --git a/source/_lovelace/button.markdown b/source/_lovelace/button.markdown index 683015300eb..c9df3733a0a 100644 --- a/source/_lovelace/button.markdown +++ b/source/_lovelace/button.markdown @@ -7,18 +7,38 @@ description: "The Button card allows you to add buttons to perform tasks." The Button card allows you to add buttons to perform tasks.

-Screenshot of the button card -Screenshot of the Button card. +Screenshot of three Button Cards +Screenshot of three Button Cards.

To add the Button card to your user interface, click the Lovelace menu (three dots at the top right of the screen) and then **Edit Dashboard**. Click the plus button in the bottom right corner and select **Button** from the card picker. All options for this card can be configured via the user interface. -Alternatively, the card can be configured using YAML: +## Card Settings -```yaml -type: button -entity: light.living_room -``` +{% configuration_basic %} +Entity: + description: The entity ID the card interacts with, for example, `light.living_room`. +Name: + description: The button name that is displayed on the card. If this field is left blank and the card interacts with an entity, the button name defaults to the entity name. Otherwise, no name is displayed. +Icon: + description: The icon that is displayed on the card. If this field is left blank and the card interacts with an entity, the icon defaults to the entity domain icon. Otherwise, no icon is displayed. +Show Name: + description: A toggle to show or hide the button name. +Show Icon: + description: A toggle to show or hide the icon. +Icon Height: + description: The height of the icon, in pixels. +Theme: + description: The card theme, which may be set to any installed theme. For more information about themes, see the [frontend documentation](https://www.home-assistant.io/integrations/frontend/). +Tap Action: + description: The action taken on card tap. For more information, see the [action documentation](/lovelace/actions/#tap-action). +Hold Action: + description: The action taken on card tap and hold. For more information, see the [action documentation](/lovelace/actions/#hold-action). +{% endconfiguration_basic %} + +### YAML + +This is for if you use YAML mode or prefer to use YAML in the Code Editor in the UI. {% configuration %} type: @@ -27,26 +47,26 @@ type: type: string entity: required: false - description: Home Assistant entity ID. + description: The entity ID the card interacts with, for example, `light.living_room`. type: string name: required: false - description: Overwrites friendly name. + description: The button name that is displayed on the card. It defaults to the entity name only if the card interacts with an entity. Otherwise, if not configured, no name is displayed. type: string - default: Name of Entity + default: Entity name icon: required: false - description: Icon that will be be used to overwrite the entity picture or entity icon. + description: The icon that is displayed on the card. It defaults to the entity domain icon only if the card interacts with an entity. Otherwise, if not configured, no icon is displayed. type: string default: Entity Domain Icon show_name: required: false - description: Show name. + description: If false, the button name is not shown on the card. type: boolean default: "true" show_icon: required: false - description: Show icon. + description: If false, the icon is not shown on the card. type: boolean default: "true" show_state: @@ -56,44 +76,51 @@ show_state: default: "false" icon_height: required: false - description: Set the height for the icon. This is in pixels which is handled by the configuration UI. (Advanced users can use other CSS values if they like) + description: The height of the icon. Any CSS value may be used. type: string default: auto state_color: required: false - description: Set to `true` to have icons colored when entity is active + description: If false, the icon does not change color when the entity is active. type: boolean default: true tap_action: required: false - description: Action taken on card tap. See [action documentation](/lovelace/actions/#tap-action). + description: The action taken on card tap. For more information, see the [action documentation](/lovelace/actions/#tap-action). type: map hold_action: required: false - description: Action taken on card tap and hold. See [action documentation](/lovelace/actions/#hold-action). + description: The action taken on card tap and hold. For more information, see the [action documentation](/lovelace/actions/#hold-action). type: map double_tap_action: required: false - description: Action taken on card double tap. See [action documentation](/lovelace/actions/#double-tap-action). + description: The action taken on card double-tap. For more information, see the [action documentation](/lovelace/actions/#double-tap-action). type: map theme: required: false - description: "Set to any theme within `themes.yaml`" + description: The card theme, which may be set to any theme from the `themes.yaml` file. For more information about themes, see the [frontend documentation](https://www.home-assistant.io/integrations/frontend/). type: string {% endconfiguration %} +Example: + +```yaml +type: button +entity: light.living_room +``` + ## Options For Exemptions {% configuration badges %} user: required: true - description: User id that can see the view tab. + description: The id of the user that can see the view tab. type: string {% endconfiguration %} ## Examples -Title and Script Service Example: +Button Card with a button name and a script that runs when card is tapped: ```yaml type: button @@ -107,6 +134,6 @@ tap_action: ```

-Screenshot of the button card -Screenshot of the Button card with Title and Script Service. +Screenshot of the Button card with Script Service +Screenshot of the Button card with Script Service.