Skip to content

Commit f4b52bb

Browse files
Merge pull request #1869 from nhsuk/date-input-fields
[v10] Add date input `day`, `month` and `year` options
2 parents c0e350a + a68172f commit f4b52bb

8 files changed

Lines changed: 543 additions & 112 deletions

File tree

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,48 @@ Note: This release was created from the `support/10.x` branch.
66

77
### :new: **New features**
88

9+
#### Add date input `day`, `month` and `year` options
10+
11+
We've updated the date input component to add individual `day`, `month` and `year` Nunjucks options.
12+
13+
These new options can be used to partially override the defaults. For example, setting `error: true` on the year item no longer requires all other item defaults to be set:
14+
15+
```patch
16+
{{ dateInput({
17+
fieldset: {
18+
legend: {
19+
text: "What is your date of birth?",
20+
size: "l",
21+
isPageHeading: true
22+
}
23+
},
24+
- items: [
25+
- {
26+
- name: "dob[day]",
27+
- label: "Day",
28+
- width: 2
29+
- },
30+
- {
31+
- name: "dob[month]",
32+
- label: "Month",
33+
- width: 2
34+
- },
35+
- {
36+
- name: "dob[year]",
37+
- label: "Year",
38+
- width: 4,
39+
- error: true
40+
- }
41+
- ]
42+
+ namePrefix: "dob",
43+
+ year: {
44+
+ error: true
45+
+ }
46+
}) }}
47+
```
48+
49+
This was added in [pull request #1869: Add date input `day`, `month` and `year` options](https://github.com/nhsuk/nhsuk-frontend/pull/1869).
50+
951
#### Add icons to buttons
1052

1153
You can now [add icons](https://service-manual.nhs.uk/design-system/styles/icons) to buttons using the `icon` Nunjucks options.

packages/nhsuk-frontend-review/src/examples/translated.njk

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,35 @@
9393
}
9494
}) }}
9595

96+
{{ dateInput({
97+
fieldset: {
98+
legend: {
99+
text: "Beth yw eich dyddiad geni?",
100+
size: "l",
101+
isPageHeading: true
102+
}
103+
},
104+
hint: {
105+
text: "Er enghraifft, 31 3 1980"
106+
},
107+
id: "with-translations-date",
108+
day: {
109+
label: {
110+
text: "Dydd"
111+
}
112+
},
113+
month: {
114+
label: {
115+
text: "Mis"
116+
}
117+
},
118+
year: {
119+
label: {
120+
text: "Blwyddyn"
121+
}
122+
}
123+
}) }}
124+
96125
{{ passwordInput({
97126
label: {
98127
text: 'Cyfrinair',

0 commit comments

Comments
 (0)