Skip to content

DatePicker

DatePicker and MonthPicker

Widget for selecting the date/month.

jsx
import { DatePicker, MonthPicker } from '@semcore/ui/date-picker';
<DatePicker />;
<MonthPicker />;

DatePickerProps

& & {...}
NameTypeDescription
value The selected date, accepts everything which is accepted by `new Date()`
onChange(date: ) => void To be activated upon selecting the date
disabled( | ( | false)[] | string)[] Array of dates blocked for selection
disabledErrorText((attemptedDate: ) => string) | string | null Error message when user attempts to input a disabled date
displayedPeriod Date for showing the necessary month
onDisplayedPeriodChange(date: ) => void To be activated upon changing the current shown month
size"m" | "l" Component size
highlighted[] The selected date, accepts everything which is accepted by `new Date()`
defaultValue Default value selected date, accepts everything which is accepted by `new Date()`
defaultDisplayedPeriod Default value date for showing the necessary month
defaultHighlighted[] Default value selected date, accepts everything which is accepted by `new Date()`

DateRangePicker

Widget for selecting the range of dates/months.

jsx
import { DateRangePicker, MonthRangePicker } from '@semcore/ui/date-picker';
<DateRangePicker />;
<MonthRangePicker />;

DateRangePickerProps

& & {...}
NameTypeDescription
value[] The selected date, accepts everything which is accepted by `new Date()`
defaultValue[] Default value selected date, accepts everything which is accepted by `new Date()`
defaultDisplayedPeriod Default value date for showing the necessary month
defaultHighlighted[] Default value selected date, accepts everything which is accepted by `new Date()`
onChange(date: []) => void To be activated upon selecting the date
disabled( | ( | false)[] | string)[] Array of dates blocked for selection
disabledErrorText((attemptedDate: ) => string) | string | null Error message when user attempts to input a disabled date
displayedPeriod Date for showing the necessary month
onDisplayedPeriodChange(date: ) => void To be activated upon changing the current shown month
highlighted[] The selected date, accepts everything which is accepted by `new Date()`
unclearableboolean Remove the 'Reset' button
onHighlightedChange(date: []) => void To be activated upon selecting the date
preselectedValue[] Intermediate value between `highlighted` and `value` that user see before explicitly applying it.
onPreselectedValueChange(date: []) => void Normally called when user preselects a date range and when user applies this range.
periods( & {value: [] })[] Array of periods [{value: [new Date(), new Date()], children: "Today"}]

DatePicker.Trigger and DateRangePicker.Trigger

Trigger input, exists by default. DateRangePicker has the same interface.

jsx
import { DatePicker } from '@semcore/ui/date-picker';
<DatePicker.Trigger />;

BaseTriggerProps

& & & {...}
NameTypeDescription
size"m" | "l" Trigger size
state"normal" | "valid" | "invalid" Trigger state
activeboolean Sets active state to trigger
emptyboolean Responsible for placeholder displaying
placeholder Placeholder text
disabledboolean Sets disabled state to trigger

DateRangePicker.Period

Component for rendering the configurable periods.

jsx
import { DateRangePicker } from '@semcore/ui/date-picker';
<DateRangePicker.Period />;

DateRangePickerPeriodProps

& {...}
NameTypeDescription
value[] Current selected period
onChange(date: []) => void To be activated by clicking the button for switching the selected period.
onDisplayedPeriodChange(date: ) => void To be activated by hovering a cursor over the button for changing the current displayed month.
onHighlightedChange(date: []) => void To be activated by hovering a cursor over the button for selecting the dates.
periods( & {value: [] })[] Array of periods [{value: [new Date(), new Date()], children: "Today"}]

Calendar

Calendar component 📅

jsx
import { DatePicker, MonthPicker } from '@semcore/ui/date-picker';
<DatePicker.Calendar />;
<MonthPicker.Calendar />;

CalendarProps

& {...}
NameTypeDescription
locale["language"] Locale for displaying the days of a week and months, to be transferred to `Intl`
disabled Array of dates blocked for selection
value[] The selected date, accepts everything which is accepted by `new Date()`
onChange(date: []) => void To be activated upon selecting the date
displayedPeriod Date for showing the necessary month
renderOutdatedboolean Controls whether to render dates from previous/next months

Calendar.Unit

The unit inside the calendar.

jsx
import { DatePicker, MonthPicker } from '@semcore/ui/date-picker';
<DatePicker.Calendar.Unit />;
<MonthPicker.Calendar.Unit />;

CalendarUnitProps

& {...}
NameTypeDescription
selectedboolean Indicates if the calendar unit is part of a selected date range
outdatedboolean Marks units from previous/next months that appear in the current month view
disabledboolean Prevents interaction with the unit
todayboolean Highlights the current date
startSelectedboolean Marks the beginning of a selected date range
endSelectedboolean Marks the end of a selected date range
highlightedboolean Shows preview highlighting during range selection
startHighlightedboolean Marks the start of a highlighted range
endHighlightedboolean Marks the end of a highlighted range
date The actual Date object this unit represents
children Content to display within the unit (typically the day number)

DateRangeComparator

Same API for MonthDateRangeComparator.

DateRangeComparatorProps

& & {...}
NameTypeDescription
value Selected date ranges
defaultValue Default value for selected date ranges
defaultDisplayedPeriod Default value date for showing the necessary month
defaultHighlighted[] Default value selected date, accepts everything which is accepted by `new Date()`
onChange(ranges: {value?: []; compare?: [] }) => void Called with selected date when user clicks `Apply` button.
disabled( | ( | false)[] | string)[] Array of dates blocked for selection
disabledErrorText((attemptedDate: ) => string) | string | null Error message when user attempts to input a disabled date
displayedPeriod Date for showing the necessary month
onDisplayedPeriodChange(date: ) => void To be activated upon changing the current shown month
highlighted[] The selected date, accepts everything which is accepted by `new Date()`
onHighlightedChange(date: []) => void To be activated upon selecting the date
compareHighlighted[] The selected date, accepts everything which is accepted by `new Date()`
onCompareHighlightedChange(date: []) => void To be activated upon selecting the date
preselectedValue[] Intermediate value between `highlighted` and `value` that user see before explicitly applying it.
onPreselectedValueChange(date: []) => void Normally called when user preselects a date range and when user applies this range.
preselectedCompare[] Intermediate value between `compareHighlighted` and `compare` that user see before explicitly applying it.
onPreselectedCompareChange(date: []) => void Normally called when user preselects a compare range and when user applies ranges.
compareToggleboolean Controls that compare range input is enabled.
onCompareToggleChange(compareToggle: boolean) => void Toggles when compare range input enables or disables.
focusedRange Controls which date range is focused.
onFocusedRangeChange(focusedRange: ) => void Called when user focuses or is focused on some of the date ranges.
unclearableboolean Remove the 'Reset' button
periods( & {value: [] })[] Array of periods [{value: [new Date(), new Date()], children: "Today"}]

Released under the MIT License.

Released under the MIT License.