Date Picker
Examples
Default
dd/mm/yyyy
Code
1<DatePicker id="datepicker-1" label="Select a date" value={value} onChange={setValue} />
With value set
dd/mm/yyyy
Code
1<DatePicker id="datepicker-2" label="Select a date" value={value} />
Defined selectable months and years in the dropdown
dd/mm/yyyy
Code
1<DatePicker id="datepicker-2" label="Select a date" fromYear={2020} toYear={2030} />
Initial month
dd/mm/yyyy
Code
1<DatePicker id="datepicker-22" label="Select a date" initialMonth={new Date(2024, 8)} />
Selectable dates within a range
dd/mm/yyyy
Code
1<DatePicker id="datepicker-24" label="Select a date" minDate={new Date(2023, 8, 11)} maxDate={new Date(2023, 8, 26)} />
With field declaration
dd/mm/yyyy
dd/mm/yyyy
Code
1<DatePicker id="datepicker-3r" label="Select a date" declaration="required" />23<DatePicker id="datepicker-3o" label="Select a date" required={false} declaration="optional" />
With a different form control size applied
dd/mm/yyyy
dd/mm/yyyy
dd/mm/yyyy
Code
1<DatePicker id="datepicker-4" label="Select a date" size="small" />2<DatePicker id="datepicker-5" label="Select a date" />3<DatePicker id="datepicker-6" label="Select a date" size="large" />
With a different label size applied
dd/mm/yyyy
dd/mm/yyyy
dd/mm/yyyy
Code
1<DatePicker id="datepicker-7" label="Select a date" labelSize="small" />2<DatePicker id="datepicker-8" label="Select a date" />3<DatePicker id="datepicker-9" label="Select a date" labelSize="large" />
With a different calendar size applied
dd/mm/yyyy
dd/mm/yyyy
dd/mm/yyyy
Code
1<DatePicker id="datepicker-10" label="Select a date" calendarSize="small" />2<DatePicker id="datepicker-11" label="Select a date" />3<DatePicker id="datepicker-12" label="Select a date" calendarSize="large" />
With label element hidden
dd/mm/yyyy
Code
1<DatePicker id="datepicker-13" label="Select a date" labelHidden />
With label context applied
dd/mm/yyyy
Code
1<DatePicker id="datepicker-14" label="Select a date" labelContext="Type the date string in dd/mm/yyyy" />
With error validation
dd/mm/yyyy
This is error text
Code
1<DatePicker id="datepicker-15" label="Select a date" error errorText="This is error text" />
As a disabled form control
dd/mm/yyyy
Code
1<DatePicker id="datepicker-16" label="Select a date" disabled />