Skip to content

Commit d4eb251

Browse files
Add support for text input placeholder
1 parent 660669f commit d4eb251

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

packages/nhsuk-frontend/src/nhsuk/components/header/_index.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,6 @@ $nhsuk-header-reverse-item-active-colour: $nhsuk-reverse-text-colour;
323323
border: $nhsuk-border-width-form-element solid $nhsuk-focus-text-colour;
324324
}
325325

326-
&::placeholder {
327-
opacity: 1; // Fixes low contrast of placeholder text in firefox
328-
color: nhsuk-colour("grey-1");
329-
}
330-
331326
// Hide search input clear button (IE)
332327
&::-ms-clear {
333328
display: none;

packages/nhsuk-frontend/src/nhsuk/components/input/_index.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
background-color: transparent;
4343
cursor: not-allowed;
4444
}
45+
46+
&::placeholder {
47+
opacity: 1; // Fixes low contrast of placeholder text in firefox
48+
color: nhsuk-colour("grey-1");
49+
}
4550
}
4651

4752
.nhsuk-input::-webkit-outer-spin-button,

packages/nhsuk-frontend/src/nhsuk/components/input/macro-options.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@ export const params = {
200200
description:
201201
'Attribute to provide a regular expression pattern, used to match allowed character combinations for the input value.'
202202
},
203+
placeholder: {
204+
type: 'string',
205+
required: false,
206+
description: 'Attribute to provide placeholder text for the input.'
207+
},
203208
spellcheck: {
204209
type: 'boolean',
205210
required: false,

packages/nhsuk-frontend/src/nhsuk/components/input/template.njk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@
7272
value: params.pattern,
7373
optional: true
7474
},
75+
placeholder: {
76+
value: params.placeholder,
77+
optional: true
78+
},
7579
inputmode: {
7680
value: params.inputmode,
7781
optional: true

0 commit comments

Comments
 (0)