diff --git a/src/components/ha-multi-textfield.ts b/src/components/ha-multi-textfield.ts index 2e5e5e73d94a..dd1d46b8b2ee 100644 --- a/src/components/ha-multi-textfield.ts +++ b/src/components/ha-multi-textfield.ts @@ -1,6 +1,6 @@ import { mdiDeleteOutline, mdiPlus } from "@mdi/js"; import type { CSSResultGroup } from "lit"; -import { LitElement, css, html } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { haStyle } from "../resources/styles"; @@ -8,6 +8,7 @@ import type { HomeAssistant } from "../types"; import "./ha-button"; import "./ha-icon-button"; import "./ha-textfield"; +import "./ha-input-helper-text"; import type { HaTextField } from "./ha-textfield"; @customElement("ha-multi-textfield") @@ -20,6 +21,8 @@ class HaMultiTextField extends LitElement { @property() public label?: string; + @property({ attribute: false }) public helper?: string; + @property({ attribute: false }) public inputType?: string; @property({ attribute: false }) public inputSuffix?: string; @@ -69,12 +72,21 @@ class HaMultiTextField extends LitElement { `; })} -
+
- ${this.addLabel ?? this.hass?.localize("ui.common.add") ?? "Add"} + ${this.addLabel ?? + (this.label + ? this.hass?.localize("ui.components.multi-textfield.add_item", { + item: this.label, + }) + : this.hass?.localize("ui.common.add")) ?? + "Add"}
+ ${this.helper + ? html`${this.helper}` + : nothing} `; } diff --git a/src/components/ha-selector/ha-selector-text.ts b/src/components/ha-selector/ha-selector-text.ts index b7c7b6015958..4ba9f9257997 100644 --- a/src/components/ha-selector/ha-selector-text.ts +++ b/src/components/ha-selector/ha-selector-text.ts @@ -50,6 +50,7 @@ export class HaTextSelector extends LitElement { .inputType=${this.selector.text?.type} .inputSuffix=${this.selector.text?.suffix} .inputPrefix=${this.selector.text?.prefix} + .helper=${this.helper} .autocomplete=${this.selector.text?.autocomplete} @value-changed=${this._handleChange} > diff --git a/src/translations/en.json b/src/translations/en.json index d7495221c9db..c0909df932d3 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1115,6 +1115,9 @@ "last_updated": "Last updated", "remaining_time": "Remaining time", "install_status": "Install status" + }, + "multi-textfield": { + "add_item": "Add {item}" } }, "dialogs": {