Skip to content
Forms, switch product

Date Input

Date Input widgets are Input Fields that provide a structured, segmented text-input approach to manual date entry, offering a keyboard-friendly alternative to interactive calendars. The date segments automatically localize based on the user’s region and locale.

dateinput.ts
import { gui } from '@golemui/gui-shared';
export default [
gui.inputs.dateInput('birthDate', {
label: 'Birth Date',
}),
];
dateinput.json
{
"$schema": "https://golemui.com/schemas/form.schema.json",
"form": [
{
"kind": "input",
"type": "dateInput",
"path": "birthDate",
"label": "Birth Date"
}
]
}

Use these props to customize your Date Input widget.

proptypedescription
dayAriaLabelstringARIA label for the day segment input. Defaults to Day
hintstringA description to display below the segmented inputs
iconstringA css class to display an icon inside the input
incompleteMessagestring | LocalizableError message shown when focus leaves the widget with a partially filled date behind; the value goes to null so validators report it
invalidDateMessagestring | LocalizableError message shown when the completed date does not exist, e.g. February 30
maxDatestringLatest allowed date (ISO date, inclusive)
maxDateMessagestring | LocalizableError message shown when the entered date is after maxDate
minDatestringEarliest allowed date (ISO date, inclusive)
minDateMessagestring | LocalizableError message shown when the entered date is before minDate
monthAriaLabelstringARIA label for the month segment input. Defaults to Month
yearAriaLabelstringARIA label for the year segment input. Defaults to Year

Use the property hint to add a description or validation instructions.

dateinput.ts
import { gui } from '@golemui/gui-shared';
export default [
gui.inputs.dateInput('birthDate', {
hint: 'Please enter your date of birth',
label: 'Birth Date',
}),
];
dateinput.json
{
"$schema": "https://golemui.com/schemas/form.schema.json",
"form": [
{
"kind": "input",
"type": "dateInput",
"path": "birthDate",
"label": "Birth Date",
"props": {
"hint": "Please enter your date of birth"
}
}
]
}

Use the property icon to add an icon to the widget. The value of icon represents a set of CSS classes separated by spaces. The icon is displayed inside the input border.

dateinput.ts
import { gui } from '@golemui/gui-shared';
export default [
gui.inputs.dateInput('birthDate', {
icon: 'calendar_month',
label: 'Birth Date',
}),
];
dateinput.json
{
"$schema": "https://golemui.com/schemas/form.schema.json",
"form": [
{
"kind": "input",
"type": "dateInput",
"path": "birthDate",
"label": "Birth Date",
"props": {
"icon": "calendar_month"
}
}
]
}

Use the properties minDate and maxDate (ISO dates, both inclusive) to specify the boundaries for accepted dates. A completed date outside the boundaries raises an input error instead of a value; customize (and localize) the messages with minDateMessage and maxDateMessage.

dateinput.ts
import { gui } from '@golemui/gui-shared';
export default [
gui.inputs.dateInput('appointmentDate', {
hint: 'Appointments available between 2026-02-01 and 2026-07-31',
minDate: '2026-02-01',
maxDate: '2026-07-31',
minDateMessage: 'No appointments before February 2026',
maxDateMessage: 'No appointments after July 2026',
label: 'Appointment Date',
}),
];
dateinput.json
{
"$schema": "https://golemui.com/schemas/form.schema.json",
"form": [
{
"kind": "input",
"type": "dateInput",
"path": "appointmentDate",
"label": "Appointment Date",
"props": {
"hint": "Appointments available between 2026-02-01 and 2026-07-31",
"minDate": "2026-02-01",
"maxDate": "2026-07-31",
"minDateMessage": "No appointments before February 2026",
"maxDateMessage": "No appointments after July 2026"
}
}
]
}

Use the property invalidDateMessage to customize (and localize) the error shown when the completed segments don’t form a real calendar date, such as February 30 or the 13th month.

dateinput.ts
import { gui } from '@golemui/gui-shared';
export default [
gui.inputs.dateInput('birthDate', {
hint: 'Try a date that doesn\'t exist, e.g. February 30',
invalidDateMessage: 'Please enter a real calendar date',
label: 'Birth Date',
}),
];
dateinput.json
{
"$schema": "https://golemui.com/schemas/form.schema.json",
"form": [
{
"kind": "input",
"type": "dateInput",
"path": "birthDate",
"label": "Birth Date",
"props": {
"hint": "Try a date that doesn't exist, e.g. February 30",
"invalidDateMessage": "Please enter a real calendar date"
}
}
]
}

Date Inputs can be styled as explained in the Styling Guide.

Following you will find a list with the CSS Variables and a quick description of what you will style.

CSS VariableDescription
--gui-intent-errorBorder and focus shadow color when invalid
--gui-text-defaultActive piece (day/month/year) visual underline color and standard focus shadow

This is the anatomy of the Date Input Widget in case you want to use your CSS styles.

dateinput-anatomy.html
<gui-date>
<label for="fieldUid">
Label
<div class="gui-date__hint" id="fieldUid_hint">Hint</div>
</label>
<div class="gui-widget">
<div class="gui-date-input gui-calendar--icon" role="group">
<div class="gui-date-input__touch-target">
<input type="text" inputmode="numeric" class="gui-date-input__part" data-type="month" maxlength="2" placeholder="mm" tabindex="0" value="12">
<div class="gui-date-input__visual-underline"></div>
</div>
<span class="gui-date-input__separator">/</span>
<div class="gui-date-input__touch-target">
<input type="text" inputmode="numeric" class="gui-date-input__part" data-type="day" maxlength="2" placeholder="dd" tabindex="-1" value="25">
<div class="gui-date-input__visual-underline"></div>
</div>
<span class="gui-date-input__separator">/</span>
<div class="gui-date-input__touch-target">
<input type="text" inputmode="numeric" class="gui-date-input__part gui-date-input__year" data-type="year" maxlength="4" placeholder="yyyy" tabindex="-1" value="2024">
<div class="gui-date-input__visual-underline"></div>
</div>
</div>
<span class="gui-widget-icon fas fa-calendar"></span>
</div>
</gui-date>