Skip to main content
Version: 1.1.0

IDateTimePickerProps

@spartanfx/react v1.1.0


@spartanfx/react / index / IDateTimePickerProps

Interface: IDateTimePickerProps

Props accepted by the DateTimePicker component.

Properties

PropertyTypeDescription
allFocusable?booleanWhether disabled elements should remain focusable. Default false
allowClear?booleanWhether the user can clear the field with a dedicated button. Default true
allowTextInput?booleanWhether text input is allowed in the display field. Default false
appearanceMode?AppearanceModeAppearance mode (theme). Default AppearanceMode.light
ariaLabel?stringAria label for the trigger button.
borderless?booleanRemoves the border from the trigger TextField. Mirrors Fluent UI DatePicker's borderless. Default false
calendarProps?Partial<ICalendarProps>Props forwarded to the underlying Fluent UI Calendar.
calloutProps?Partial<ICalloutProps>Props forwarded to the popup Callout.
className?stringOptional class name merged with the root element.
classNames?IDateTimePickerClassNamesClass name overrides applied to the inner elements.
dateTimeFormatter?IDateFormattingAdvanced date formatting hook forwarded to the underlying Fluent UI Calendar.
disabled?booleanWhether the component is disabled. Default false
errorMessage?stringOptional error message displayed below the field.
firstDayOfWeek?DayOfWeekFirst day of the week displayed in the calendar. Default DayOfWeek.Sunday
firstWeekOfYear?FirstWeekOfYearDefines which week is considered the first week of the year. Default FirstWeekOfYear.FirstDay
formatDateTime?(date) => stringCustom formatter used to display the selected date/time in the field. Replaces the default locale-aware layout.
highlightCurrentMonth?booleanWhether the calendar should highlight the current month in the month picker. Default false
highlightSelectedMonth?booleanWhether the calendar should highlight the selected month in the month picker. Default true
iconProps?IIconPropsIcon displayed inside the trigger button. Defaults to Calendar.
id?stringOptional id applied to the root of the TextField (useful for label association in forms).
initialPickerDate?DateThe date initially highlighted in the calendar when the popup opens for the first time and no value is set.
isMonthPickerVisible?booleanWhether the month picker is shown beside the day picker or hidden. Default true
label?stringLabel rendered above the field.
maxDate?DateMaximum selectable date (time is ignored for boundary checks).
minDate?DateMinimum selectable date (time is ignored for boundary checks).
minuteStep?numberStep (in minutes) applied by the minutes field. Default 1
onAfterMenuDismiss?() => voidCallback invoked after the popup is dismissed (either via the Done button, clicking outside or pressing Escape). Mirrors Fluent UI's onAfterMenuDismiss callback.
onChange(date) => voidCallback triggered when the user commits a new value. Commit points are: - Pressing the Done button in the popup (after editing date / time / AM-PM / Now / Clear). All popup interactions update an internal draft — the parent is only notified once. - Clicking the trigger-icon clear button on the field (immediate). - Pressing Enter / blurring the trigger field when allowTextInput is enabled (immediate). - Selecting a date when showTime is false (immediate, since there is no time to confirm with). Dismissing the popup without pressing Done discards the draft. The returned Date is always expressed in the user's local timezone — only the hour and minute components are user controlled, seconds and milliseconds are reset to 0.
openOnClick?booleanWhether the popup should open when the user clicks the input. Set to false to only open via the trigger icon. Default true
parseDateTimeFromString?(value) => DateCustom parser for the text input when allowTextInput is true. Should return a valid Date or null when the input is not a valid value.
pickerAriaLabel?stringAria label used for the popup (calendar).
placeholder?stringPlaceholder text displayed when the field is empty. Default 'Select date & time...'
required?booleanWhether the field is required (adds the Fluent UI required marker). Default false
showCloseButton?booleanWhether the calendar day close button should be shown.
showGoToToday?booleanWhether the "Go to today" link should be shown in the calendar. Default false
showMonthPickerAsOverlay?booleanShow the month picker as an overlay on top of the day picker. Default false
showTime?booleanWhether to show the time portion. Default true
showWeekNumbers?booleanWhether the calendar should show week numbers before each row. Default false
strings?ICalendarStringsLocalized strings forwarded to the calendar.
style?CSSPropertiesInline style applied to the root element.
tabIndex?numberTab index applied to the trigger TextField.
textField?Partial<ITextFieldProps>Props forwarded to the underlying Fluent UI TextField used as the display/trigger for the popup. Mirrors Fluent UI DatePicker's textField.
textFieldStyles?IDateTimePickerTextFieldStylesCustom styles applied to the display TextField.
timeFormat?TimeFormatTime format used inside the popup and for the display text. Default TimeFormat.H24
today?DateValue used as "today" inside the calendar — defaults to the current machine time when omitted.
tokens?IDateTimePickerTokensCustomization tokens used to override colors, radius, sizes and animations. Merged on top of the theme derived from appearanceMode.
translate?(text) => stringOptional localization function. Applied to every built-in label used inside the popup (Time, Now, Clear, Done, ...).
underlined?booleanRenders the trigger TextField with the underlined variant. Mirrors Fluent UI DatePicker's underlined. Default false
value?DateCurrent date/time value. null or undefined leaves the input empty.
width?string | numberWidth applied to the display field (CSS string or number of pixels).