From 45a1a27d1ac771bc2dd642aa944790739313cccb Mon Sep 17 00:00:00 2001 From: Benny Powers Date: Wed, 20 Sep 2023 16:55:41 +0300 Subject: [PATCH] feat(text-input): placeholder (#2595) Closes #2594 --- .changeset/pf-text-input-placeholder.md | 4 ++++ elements/pf-text-input/pf-text-input.ts | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/pf-text-input-placeholder.md diff --git a/.changeset/pf-text-input-placeholder.md b/.changeset/pf-text-input-placeholder.md new file mode 100644 index 0000000000..cbb24477dc --- /dev/null +++ b/.changeset/pf-text-input-placeholder.md @@ -0,0 +1,4 @@ +--- +"@patternfly/elements": minor +--- +``: added `placeholder` attribute diff --git a/elements/pf-text-input/pf-text-input.ts b/elements/pf-text-input/pf-text-input.ts index 7b20d06044..f4f1b15471 100644 --- a/elements/pf-text-input/pf-text-input.ts +++ b/elements/pf-text-input/pf-text-input.ts @@ -188,6 +188,9 @@ export class PfTextInput extends LitElement { /** Flag to show if the input is read only. */ @property({ type: Boolean, reflect: true }) readonly = false; + /** Input placeholder. */ + @property() placeholder?: string; + /** Value of the input. */ @property() value = ''; @@ -217,6 +220,7 @@ export class PfTextInput extends LitElement { ?readonly="${this.readonly}" ?required="${this.required}" aria-label="${this.#derivedLabel}" + placeholder="${ifDefined(this.placeholder)}" type="${ifDefined(this.type)}" .value="${this.value}" style="${ifDefined(this.customIconUrl && styleMap({