Skip to content

DatePicker

A date picker component for selecting dates and date ranges.

import { useState } from 'react';
// Import component
import { DatePicker } from '@fintech-sandpit/ui/react';
// Import styles (optional). Please note that you need to import the styles
// for DatePicker and ReadOnlyInput components since the DatePicker component
// is composed of these components.
import '@fintech-sandpit/ui/style/components/date_picker.css';
import '@fintech-sandpit/ui/style/components/readonly_input.css';
const [value, setValue] = useState<Date[]>([
new Date('2026-01-15'),
]);
return (
<DatePicker
value={value}
mode="single"
label="Select date"
placeholder="No date selected yet"
onChange={setValue}
/>
);
import { useState } from 'react';
// Import component
import { DatePicker } from '@fintech-sandpit/ui/react';
// Import styles (optional)
import '@fintech-sandpit/ui/style/components/date_picker.css';
import '@fintech-sandpit/ui/style/components/readonly_input.css';
const [value, setValue] = useState<Date[]>([
new Date('2026-01-01'),
new Date('2026-01-31'),
]);
return (
<DatePicker
value={value}
mode="range"
label="Select date range"
numOfMonths={2}
placeholder="No date range selected yet"
onChange={setValue}
/>
);
NameTypeDefaultDescription
valueDate[]The value of the date picker (controlled)
defaultValueDate[]Default value of the date picker (uncontrolled)
labelstringLabel under the date input
placeholderstringPlaceholder text
modeDatePickerSelectionMode'single'Selection mode
numOfMonthsnumber1Number of months to display
startOfWeeknumber1First day of the week (0 = Sunday, 1 = Monday, etc.)
minDateMin allowed date
maxDateMax allowed date
defaultViewDatePickerViewDefault view of the date picker
minViewDatePickerViewMin allowed view
maxViewDatePickerViewMax allowed view
orientationOrientation'vertical'Orientation of the text input
colorSchemeDatePickerColorScheme'neutral'Color scheme
sizeFieldSize'md'Size
formatstring'%j.%m.%Y'Format of the output date 1
timeZonestring'UTC'Time zone
clearablebooleanfalseWhether the input value can be cleared
requiredbooleanfalseWhether the input is required
invalidbooleanfalseWhether the input is invalid
readOnlybooleanfalseWhether the input is read only
disabledbooleanfalseWhether the input is disabled
closeOnSelectbooleanfalseWhether to close the popup after selecting a date
fixedWeeksbooleanfalseWhether to fix the number of weeks in the popup
lazyMountbooleanfalseWhether to lazy mount the popup window
presetsDatePickerPreset[]Date range presets 2
  1. Date formats are described on the FormatDate component page.
  2. Makes sense only in range mode.
NameArgumentsDescription
onValueChange(value: Date[]) => voidCallback fired when the value changes
type DatePickerColorScheme = 'neutral' | 'primary' | 'secondary'
type DatePickerPreset = {
label: string;
value: (
| 'thisWeek'
| 'lastWeek'
| 'thisMonth'
| 'lastMonth'
| 'thisQuarter'
| 'lastQuarter'
| 'thisYear'
| 'lastYear'
| 'last3Days'
| 'last7Days'
| 'last14Days'
| 'last30Days'
| 'last90Days'
);
}
type DatePickerSelectionMode = 'single' | 'multiple' | 'range'
type DatePickerView = 'day' | 'month' | 'year'
type FieldSize = 'sm' | 'md' | 'lg'
type Orientation = 'horizontal' | 'vertical'