GC Design System Components Page templates Get started Contact us Get involved Find a demo GC Design System Components

Date input
<gcds-date-input>

Also called: dates, dateinput, date, memorable date.

A date input is a space to enter a known date.

Date input component preview

Build a date input

Use a date input to collect a date from a person when you’re expecting them to enter a date they already know or can verify.

Coding and accessibility for date inputs

Apply required attributes

For the date input to function properly, always use the following attributes with <gcds-date-input>:

Format the date input

Entering and receiving the value from date input

Date input can receive and output different value formats depending on the format attribute:

Use valid properties

Component properties have built-in validation. Required properties or properties prone to misuse will be validated. If there are any validation errors, the component will be non-functional and won't render. Review the browser's console for details and adjust the properties accordingly to ensure proper functionality.

Handle error messages and validation

Include a hint text for task success

Get your code

Generate an instance of the component you need by selecting its code properties.

  1. Explore by choosing different code values to generate the instance you want.

  2. Get the code and pull it into your environment.

  3. Add any copy you need to the component (like text for a label).

Note: The code builder uses English for all code elements, which follows standard practice.

Help us improve

Have questions or a request? Give feedback on our contact form.

Something's wrong? Raise it through GitHub with an account. You'll have access to the team's direct responses, progress made on your issue, and issues raised by others.

Give feedback Report an issue on GitHub
2024-09-25