Skip to content

Date Picker

Date Picker widgets are Input Fields that let the user enter a date in a single compact field: they can type it using their keyboard or open a drop-down calendar popover to select it visually. For an always-visible inline variant, use the Calendar.

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

Use these props to customize your Date Picker widget.

proptypedescription
disabledDateRangeMessagestring | LocalizableError message shown when a typed date falls inside a disabled range
disabledRangesarrayArray of { start: string, end?: string } ISO date ranges whose days render disabled
hintstringA description to display below the input fields
iconstringCustom icon class to display inside the input visually (e.g. fas fa-calendar)
invalidDateMessagestring | LocalizableError message shown when the typed date does not exist, e.g. February 30
maxDatestringLatest allowed date (ISO date, inclusive); later calendar days render disabled
maxDateMessagestring | LocalizableError message shown when a typed date is after maxDate
minDatestringEarliest allowed date (ISO date, inclusive); earlier calendar days render disabled
minDateMessagestring | LocalizableError message shown when a typed date is before minDate
nextMonthAriaLabelstringARIA label for the next month button
nextMonthIconstringCustom CSS class for the “next month” button inside the calendar
numberOfMonthsnumberNumber of months to display simultaneously in the popover. Defaults to 1
prevMonthAriaLabelstringARIA label for the previous month button
prevMonthIconstringCustom CSS class for the “previous month” button inside the calendar

Use the property hint to add descriptive text.

date-picker.ts
import { gui } from '@golemui/gui-shared';
export default [
gui.inputs.datePicker('startDate', {
hint: 'Provide a start date to calculate your quote.',
label: 'Start Date',
}),
];
date-picker.json
{
"$schema": "https://golemui.com/schemas/form.schema.json",
"form": [
{
"kind": "input",
"type": "datePicker",
"path": "startDate",
"label": "Start Date",
"props": {
"hint": "Provide a start date to calculate your quote."
}
}
]
}

Use the property icon to add an icon, which appears next to the toggle chevron.

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

Use the properties prevMonthIcon, nextMonthIcon, prevMonthAriaLabel, and nextMonthAriaLabel to customize the navigation buttons within the calendar popover.

date-picker.ts
import { gui } from '@golemui/gui-shared';
export default [
gui.inputs.datePicker('date', {
prevMonthIcon: 'chevron_left',
nextMonthIcon: 'chevron_right',
prevMonthAriaLabel: 'Go to previous month',
nextMonthAriaLabel: 'Go to next month',
label: 'Custom Icons Date Picker',
uid: 'date-picker-icons',
}),
];
date-picker.json
{
"$schema": "https://golemui.com/schemas/form.schema.json",
"form": [
{
"uid": "date-picker-icons",
"kind": "input",
"type": "datePicker",
"path": "date",
"label": "Custom Icons Date Picker",
"props": {
"prevMonthIcon": "chevron_left",
"nextMonthIcon": "chevron_right",
"prevMonthAriaLabel": "Go to previous month",
"nextMonthAriaLabel": "Go to next month"
}
}
]
}

Use minDate and maxDate (ISO dates, both inclusive) to bound the selectable range, and disabledRanges to disable specific date blocks. Out-of-range days render disabled in the calendar popover, and a typed date that violates a boundary raises an input error; customize (and localize) the messages with minDateMessage, maxDateMessage and disabledDateRangeMessage.

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

Use the property numberOfMonths to display multiple months side-by-side in the calendar popover.

date-picker.ts
import { gui } from '@golemui/gui-shared';
export default [
gui.inputs.datePicker('appointmentDate', {
hint: 'The popover shows two months side by side',
numberOfMonths: 2,
label: 'Appointment Date',
}),
];
date-picker.json
{
"$schema": "https://golemui.com/schemas/form.schema.json",
"form": [
{
"kind": "input",
"type": "datePicker",
"path": "appointmentDate",
"label": "Appointment Date",
"props": {
"hint": "The popover shows two months side by side",
"numberOfMonths": 2
}
}
]
}

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

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

Date Pickers can be styled as explained in the Styling Guide. The typed field and the popover calendar each have their own styling variables.

Following you will find a list with the CSS Variables specific to the Date Picker popover positioning and toggle.

CSS VariableDescription
--gui-radius-mdInteractive calendar container and day button border radius
--gui-bg-defaultInteractive calendar background color
--gui-border-defaultInteractive calendar border color
--gui-space-3Internal padding within the calendar view and day buttons
--gui-text-defaultInput text color and day buttons text color
--gui-bg-disabledDisabled day background color
--gui-intent-primarySelected day background color
--gui-intent-primary-hoverToday’s day border color
--gui-border-defaultHover day border color

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

date-picker-anatomy.html
<div class="gui-form">
<gui-date-picker>
<label for="fieldUid">
Label
<div class="gui-date__hint" id="fieldUid_hint">Hint</div>
</label>
<div class="gui-widget" aria-expanded="true">
<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-alt"></span>
<gui-calendar>
<div class="gui-calendar-input">
<div class="gui-calendar__header">
<button class="gui-button gui-calendar__month-button gui-calendar__month-button--prev" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 256"><path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"></path></svg></button>
<span aria-live="polite">December 2024</span>
<button class="gui-button gui-calendar__month-button gui-calendar__month-button--next" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 256"><path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"></path></svg></button>
</div>
<div class="gui-calendar__days-grid" role="grid">
<!-- Calendar grid -->
</div>
</div>
</gui-calendar>
</div>
</gui-date-picker>
</div>