1
1
import { mdiDeleteOutline , mdiPlus } from "@mdi/js" ;
2
2
import type { CSSResultGroup } from "lit" ;
3
- import { LitElement , css , html } from "lit" ;
3
+ import { LitElement , css , html , nothing } from "lit" ;
4
4
import { customElement , property } from "lit/decorators" ;
5
5
import { fireEvent } from "../common/dom/fire_event" ;
6
6
import { haStyle } from "../resources/styles" ;
7
7
import type { HomeAssistant } from "../types" ;
8
8
import "./ha-button" ;
9
9
import "./ha-icon-button" ;
10
10
import "./ha-textfield" ;
11
+ import "./ha-input-helper-text" ;
11
12
import type { HaTextField } from "./ha-textfield" ;
12
13
13
14
@customElement ( "ha-multi-textfield" )
@@ -20,6 +21,8 @@ class HaMultiTextField extends LitElement {
20
21
21
22
@property ( ) public label ?: string ;
22
23
24
+ @property ( { attribute : false } ) public helper ?: string ;
25
+
23
26
@property ( { attribute : false } ) public inputType ?: string ;
24
27
25
28
@property ( { attribute : false } ) public inputSuffix ?: string ;
@@ -69,12 +72,21 @@ class HaMultiTextField extends LitElement {
69
72
</ div>
70
73
` ;
71
74
} ) }
72
- <div class= "layout horizontal center-center " >
75
+ <div class= "layout horizontal" >
73
76
<ha- butto n @click = ${ this . _addItem } .disabled = ${ this . disabled } >
74
- ${ this . addLabel ?? this . hass ?. localize ( "ui.common.add" ) ?? "Add" }
77
+ ${ this . addLabel ??
78
+ ( this . label
79
+ ? this . hass ?. localize ( "ui.components.multi-textfield.add_item" , {
80
+ item : this . label ,
81
+ } )
82
+ : this . hass ?. localize ( "ui.common.add" ) ) ??
83
+ "Add" }
75
84
<ha- svg- icon slot= "icon" .path = ${ mdiPlus } > </ ha- svg- icon>
76
85
</ ha- butto n>
77
86
</ div>
87
+ ${ this . helper
88
+ ? html `<ha- input- helper- text> ${ this . helper } </ ha- input- helper- text> `
89
+ : nothing }
78
90
` ;
79
91
}
80
92
0 commit comments