Forge

API reference

Full props for the DateTimePicker component.

All props are optional unless noted. Import the component and types from the package root:

import { DateTimePicker } from "react-smart-datetime";
import type { DateTimePickerProps, DateRange, Preset } from "react-smart-datetime";

Value

PropTypeDefaultDescription
valueDate | nullControlled value (single mode)
defaultValueDate | nullnullUncontrolled initial value
onChange(date: Date | null) => voidSingle-mode change callback
rangeValueDateRangeControlled range
defaultRangeValueDateRange{start:null,end:null}Uncontrolled initial range
onRangeChange(range: DateRange) => voidRange change callback

Behaviour

PropTypeDefaultDescription
mode"datetime" | "date" | "time""datetime"What to pick
rangebooleanfalseTwo-endpoint range selection
inlinebooleanfalseRender inline instead of a popover
openbooleanControlled open state
onOpenChange(open: boolean) => voidOpen-state callback
disabledbooleanfalseDisable the control
readOnlybooleanfalseShow value, block edits
clearablebooleantrueShow a clear button
closeOnSelectbooleanautoClose after a selection completes
monthsToShow1 | 2 | 31Side-by-side month grids
showWeekNumbersbooleanfalseISO week-number column
showTodayButtonbooleantrue"Today" footer shortcut
showFooterbooleantrueShow the footer row

Limits

PropTypeDefaultDescription
minDateDateEarliest selectable date
maxDateDateLatest selectable date
disabledDatesDate[] | (date) => booleanDates to disable

Time

PropTypeDefaultDescription
minuteStepnumber1Minute increment (divides 60)
secondStepnumber1Second increment (divides 60)
showSecondsbooleanfalseInclude seconds column
use24Hourbooleanfalse24-hour clock

Localization

PropTypeDefaultDescription
localestringnavigator.languageBCP-47 locale
firstDayOfWeek0…60First weekday (0 = Sunday)
dateFormatIntl.DateTimeFormatOptionsshort dateInput date format
timeFormatIntl.DateTimeFormatOptionsderivedInput time format
timeZonestringuser TZIANA time zone
showTimeZonebooleanfalseShow TZ label in footer

Shortcuts & UI

PropTypeDefaultDescription
presetsPreset[]Quick-select shortcuts
theme"light" | "dark" | "auto""light"Color theme
accentColorstringOverride accent color
radiusstringOverride border radius
placement"bottom-start" | "bottom-end" | "top-start" | "top-end""bottom-start"Popover placement (auto-flips)
placeholderstring"Select…"Empty-state text
className / styleRoot element styling
id / namestringForwarded to input / hidden input
calendarIcon / clockIconReactNodeCustom trigger icons
portalContainerHTMLElement | nulldocument.bodyPopover portal target

Exports

import {
  DateTimePicker,        // component (also the default export)
  singleDatePresets,     // Preset[]
  rangePresets,          // Preset[]
  lastNDaysPreset,       // (n, label?) => Preset
  addDays, addMonths, addYears,
  isSameDay, isSameMonth, isWithinRange,
  startOfDay, startOfMonth,
} from "react-smart-datetime";

On this page