Skip to main content

Date Picker & Time Picker

Date Picker

Usage

The Date Picker allows a user to input a date or a date range. When used with the Time Picker, a user can input a date and time.

Common Characteristics

The Date Picker is a variant of the input component with an icon on the right. The input may be normal (40px high) or small (32px high).

The Date Picker input is displayed in mm/dd/yyyy format.

The Date Picker supports keyboard navigation and input, along with the ability to set a default date, and exclude dates.

States

The Date Picker has these states: active, focused, filled, disabled, and error. The error state should only be necessary when input is required but the user skips the input.

Options

Use a pair of Date Picker inputs to input a start date and end date.

Use with a Time Picker to input a date and time.

Code

Default DatePicker

The DatePicker component displays today's date as a default value.

Live Editor
Result
Loading...

Using with Forms

For standard form handling, adding an id or name prop is expected. Label decoration is also available directly from the label prop.

Live Editor
Result
Loading...

onChange Callbacks

Live Editor
Result
Loading...

Disabled/readonly

Live Editor
Result
Loading...

DatePicker can be readonly

Live Editor
Result
Loading...

Sizing

Live Editor
Result
Loading...

With Initial Value

Live Editor
Result
Loading...

Custom placeholder

Live Editor
Result
Loading...

Custom validation status

Live Editor
Result
Loading...

Constrained Values

Live Editor
Result
Loading...

DatePicker can select date range

The with range selection, the date picker also provides a clear button. Enabling date range selection will return an array containing the start and end dates selected.

Live Editor
Result
Loading...

Props

NameTypeDefaultDescription
afterClickOutsidefunctionnullCallback function used when the calendar is closed due to a click outside of the DatePicker
afterCalendarClosefunctionnullCallback function used for any close mechanic
classNamestringnullClass name to add to the FormGroup
defaultValueDate, stringnew Date()Date used as the initially selected date
disabledboolfalseDisables the date picker
readonlyboolfalseEnables readonly state for date picker
inputClassNamestringnullClass name to add to the input
invalidbool, stringfalseDecorates the component as invalid. If is a string, then the message is also below the component
labelstringnullDecorates the component with a label element
maxDateDate, stringnew Date('12/31/9999')Maxiumum available date to select
minDateDate, stringnew Date(null)Minumum available date to select
onChangefunctionnullCallback when a date value changes
placeholderstring'mm/dd/yyyy' for single date picker,
'Select date range' for date range picker
String displayed when the input is empty
selectsRangeboolfalseEnables date range selection from the date picker
startDateDate, string, or nullnullInitial start date when using the selectsRange prop
endDateDate, string, or nullnullInitial end date when using the selectsRange prop
size"sm","lg""lg"Changes the display size of the component
triggerClassNamestringnullClass name to add to the button
validboolfalseDecorates the component as valid

Time Picker

Usage

The Time Picker allows a user to input a time. When used with the Date Picker, a user can input a date and time.

Common Characteristics

The Time Picker is a variant of the input component with an icon on the right. The input may be normal (40px high) or small (32px high).

The Time Picker input is displayed in hh:mm am/pm format.

The Time Picker supports the ability to set a default time, and exclude times.

States

The Time Picker has these states: active, focused, filled, disabled, and error. The error state should only be necessary when input is required but the user skips the input.

Options

Time Picker increments are configurable.

Use a pair of Time Picker inputs to input a start time and end time.

Use with a Date Picker to input a date and time.

Code

Default TimePicker

The TimePicker component displays current, system time as a default value.

Live Editor
Result
Loading...

TimePicker in a form

For standard form handling, adding an id or name prop is expected. Label decoration is also available directly from the label prop.

Live Editor
Result
Loading...

TimePicker will notify when time is changed

Live Editor
Result
Loading...

TimePicker can be disabled

Live Editor
Result
Loading...

TimePicker can be readonly

Live Editor
Result
Loading...

TimePicker can be small

Live Editor
Result
Loading...

TimePicker can be set initially

Live Editor
Result
Loading...

TimePicker can have a different placeholder

Live Editor
Result
Loading...

TimePicker can display differnt time intervals

Live Editor
Result
Loading...

TimePicker can be set valid or invalid

Live Editor
Result
Loading...

TimePicker can be constrained between times

Live Editor
Result
Loading...

Time Picker Props

NameTypeDefaultDescription
afterClickOutsidefunctionnullCallback function used when the calendar is closed due to a click outside of the TimePicker
afterClosefunctionnullCallback function used for any close mechanic
classNamestringnullClass name to add to the FormGroup
defaultValueDate, stringnew Date()Date used as the initially selected date
disabledboolfalseDisables the date picker
readonlyboolfalseEnables readonly state for time picker
inputClassNamestringnullClass name to add to the input
invalidbool, stringfalseDecorates the component as invalid. If is a string, then the message is also below the component
labelstringnullDecorates the component with a label element
maxTimeDate, stringnew Date('1/1 23:59:59')Maxiumum available time (as Date) to select
minTimeDate, stringnew Date('1/1 00:00:00')Minumum available time (as Date) to select
onChangefunctionnullCallback when the date value changes
placeholderstring'hh:mm a'String displayed when the input is empty
size"sm", "lg""lg"Changes the display size of the component
timeIntervalsnumber15Increment in minutes between each item in the picker
triggerClassNamestringnullClass name to add to the button
validboolfalseDecorates the component as valid