diff --git a/src/components/_all.scss b/src/components/_all.scss index 970985817..a8538defb 100644 --- a/src/components/_all.scss +++ b/src/components/_all.scss @@ -5,6 +5,7 @@ @import 'callout/callout'; @import 'card/card'; @import 'content-block/content-block'; +@import 'date-input/date-input'; @import 'dialog/dialog'; @import 'file-upload/file-upload'; @import 'filters/filters'; diff --git a/src/components/date-input/_date-input.hbs b/src/components/date-input/_date-input.hbs new file mode 100644 index 000000000..96aa834bb --- /dev/null +++ b/src/components/date-input/_date-input.hbs @@ -0,0 +1,25 @@ +
+{{#if error-text}} + +{{/if}}{{#if valid-text}} + {{error-text}} +{{/if}} \ No newline at end of file diff --git a/src/components/date-input/_date-input.scss b/src/components/date-input/_date-input.scss new file mode 100644 index 000000000..5d2759e50 --- /dev/null +++ b/src/components/date-input/_date-input.scss @@ -0,0 +1,25 @@ +.nsw-form { + &__date { + padding: 0; + margin: 0; + border: 0; + + &-wrapper { + display: flex; + width: 100%; + margin: 0 rem(-8px); + + > div { + padding: 0 rem(8px); + } + } + + &-input { + width: rem(74px); + + &--large { + width: rem(116px); + } + } + } +} diff --git a/src/components/date-input/_guidance.hbs b/src/components/date-input/_guidance.hbs new file mode 100644 index 000000000..6a251b14f --- /dev/null +++ b/src/components/date-input/_guidance.hbs @@ -0,0 +1,43 @@ +--- +title: Date input +layout: blank-layout.hbs +--- + + {{valid-text}}Use the date input component to let users enter memorable dates, like dates of birth. The date input component consists of three fields grouped together, to let users enter a day, month and year.
+ +This approach is advised in most cases because it allows for precise input and reduces the chances of making mistakes.
+ +Do:
+ +Do not:
+ +The three fields in the date input component are grouped together in a fieldset
with a legend
that describes them, as shown in the examples on this page. The legend is usually a question, such as 'What is your date of birth?'.
Use the autocomplete
attribute on the date input component when you're asking for a date of birth. This allows browsers to autofill the information on a user's behalf if they've entered it previously.
The year input is set to accept only a four-digit number while the month and day inputs can accept up to a two-digit number.
+ +All components are responsive and meet WCAG 2.1 AA accessibility guidelines.
diff --git a/src/components/date-input/blank.hbs b/src/components/date-input/blank.hbs new file mode 100644 index 000000000..ea0e7f56e --- /dev/null +++ b/src/components/date-input/blank.hbs @@ -0,0 +1,41 @@ +--- +title: Date input +width: wide +page: true +--- +{{#>_layout-container}} + +