Date picker

Lets users select a date through a calendar without the need to manually type it in a field.

Props

disabled
boolean
Disables the date picker.
error
boolean
Sets the input to an error state.
max
Date | string
Maximum date value allowed.
min
Date | string
Minimum date value allowed.
name
string
Name of the date field.
testId
string
Sets a data-testid attribute for automated testing.
type
GoabDatePickerInputType
Sets the date picker type. 'calendar' shows a calendar popup, 'input' shows just a date input.
Defaults to calendar.
value
Date | string | undefined
Value of the calendar date, as a Date object or an ISO date string (yyyy-mm-dd).
width
string
Sets the width of the date picker input.
mt, mr, mb, ml
Spacing
Apply margin to the top, right, bottom, and/or left of the component.
disabled
boolean
Sets the disabled state for the control.
error
boolean
Sets the error state for the control.
id
string
Sets the id attribute of the underlying web component.
max
Date | string
Sets the maximum date value allowed.
min
Date | string
Sets the minimum date value allowed.
name
string
Sets the name of the date field.
testId
string
Sets the data-testid attribute for automated testing.
type
GoabDatePickerInputType
Sets the date picker type. 'calendar' shows a calendar popup, 'input' shows just a date input.
Defaults to calendar.
value
Date | string | null | undefined
Sets the value of the calendar date.
width
string
Sets the width of the date picker input.
mt, mr, mb, ml
Spacing
Apply margin to the top, right, bottom, and/or left of the component.
disabled
boolean true | false
Disables the date picker.
Defaults to false.
error
boolean true | false
Sets the input to an error state.
Defaults to false.
max
string
Maximum date value allowed.
min
string
Minimum date value allowed.
name
string
Name of the date field.
size
"default" | "compact"
Sets the size of the date picker. 'compact' reduces height for dense layouts.
Defaults to default.
testid
string
Sets a data-testid attribute for automated testing.
type
"calendar" | "input"
Sets the date picker type. 'calendar' shows a calendar popup, 'input' shows just a date input.
Defaults to calendar.
value
string
Value of the calendar date.
version
"1" | "2"
Design system version for styling.
Defaults to 1.
width
string
Sets the width of the date picker input.
mt, mr, mb, ml
Spacing
Apply margin to the top, right, bottom, and/or left of the component.

Events

onBlur
(detail: GoabDatePickerOnBlurDetail) => void
Callback fired when focus leaves all of the date picker's internal fields.
onChange
(detail: GoabDatePickerOnChangeDetail) => void
Callback fired when the selected date changes.
onFocus
(detail: GoabDatePickerOnFocusDetail) => void
Callback fired when focus enters any of the date picker's internal fields.
onBlur
(event: GoabDatePickerOnBlurDetail) => void
Emits when focus leaves all of the date picker's internal fields.
onChange
(event: GoabDatePickerOnChangeDetail) => void
Emits when the selected date changes. Emits the date picker change detail including name and value.
onFocus
(event: GoabDatePickerOnFocusDetail) => void
Emits when focus enters any of the date picker's internal fields.
_blur
CustomEvent<{ name: string }>
_change
CustomEvent<{ name: string; value: Date | string | null; valueStr: string }>
_focus
CustomEvent<{ name: string }>
Examples

Ask a user for a birthday

The date picker component handles accessibility automatically. Ensure the form-item label clearly describes what date is being requested.

Confirm a change

Reset date picker field

Types

Use the calendar date picker for selecting dates relative to today, or when seeing the day of week is helpful.
Use the input date picker for known dates far in the past or future, such as a birthday.
DatePicker handles most date inputs. Use type='input' (a dropdown for month and text inputs for day and year) for known dates like birthdays, far in the past or far in the future. Use type='calendar' (a popup calendar) for dates closer to the current day when the user is picking from available days, like booking or scheduling.

Other

Indicate unavailable dates to help users avoid invalid selections.

The form item automatically associates the label with the input for screen readers, ensuring your form is accessible.

Use a form item wrapper on all inputs to add a label, helper text, error message, and more.

States

Set appropriate min and max dates for your use case. A birthdate field should limit to past dates, a booking field to future dates.
Submit

When you must disable a button or input:

  • Provide nearby text explaining what needs to happen first
  • Consider showing the element enabled with validation on submit instead
  • Use aria-describedby to link the disabled element to explanatory text
Don't disable buttons or inputs without explaining why. Disabled controls can be confusing and users may not understand why they can't interact with an element.
All GoA Design System components are built to meet WCAG 2.2 AA standards. The following guidelines provide additional context for accessible implementation.

No accessibility-specific guidelines have been documented for this component yet.

View old component docs