Knit UI
GitHub

Playground

Loading playground…

Playground
<DateInput />

Examples

Default

Single date with a label and placeholder.

Loading example…

DefaultSourceStorybook

Clearable

Clearable — a clear button appears in the trigger once a value is set.

Loading example…

ClearableSourceStorybook

Custom Format

Custom display + parse format via valueFormat.

Loading example…

Custom FormatSourceStorybook

With Time

withTime preserves the time portion when valueFormat includes it.

Loading example…

With TimeSourceStorybook

With Bounds

Bounded input — values outside [minDate, maxDate] are not accepted.

Loading example…

With BoundsSourceStorybook

With Validation

Required field with a description and an error message.

Loading example…

With ValidationSourceStorybook

Slot Styles Sugar

Per-slot styles sugar — props spread onto the composed parts.

Loading example…

Slot Styles SugarSourceStorybook

Props

PropTypeDefaultDescription
allowDeselectboolean | undefined`clearable`Allow clearing the value by emptying the input / clicking the selected day.
ariaLabelsCalendarAriaLabels | undefined—`aria-label`s for the controls on the different levels.
clearableboolean | undefinedfalseShow a clear button in the right section when the field has a value.
clearButtonPropsCloseButtonProps | undefined—Props passed to the clear button.
closeOnChangeboolean | undefinedtrueClose the dropdown when the value changes (not applicable to `multiple`).
columnsToScrollnumber | undefined`numberOfColumns`Number of columns to scroll with the next/prev buttons.
datestring | Date | undefined—Displayed date in controlled mode.
dateParser((value: string) => DateStringValue | Date | null) | undefined—Parse user input into a date string (or `Date`); falls back to the locale-aware default parser.
decadeLabelFormatDecadeLabelFormat | undefined'YYYY'dayjs format for the decade label, or a function returning it.
defaultDatestring | Date | undefined—Initial displayed date in uncontrolled mode.
defaultLevelCalendarLevel | undefined—Initial displayed level in uncontrolled mode.
defaultValueDateValue | undefined—Uncontrolled default value.
descriptionReactNode—Description rendered below the label.
disabled systemboolean | undefined——
dropdownTypePickerInputDropdownType | undefined'popover'Whether the picker opens in a floating `Popover` or a centered `Modal`.
errorReactNode—Error message / state.
excludeDate((date: DateStringValue) => boolean) | undefined—Predicate marking a day disabled.
firstDayOfWeekDayOfWeek | undefined`DatesProvider` (1)First weekday of each row, `0` (Sunday) … `6` (Saturday).
fixOnBlurboolean | undefinedtrueRestore the last valid value on blur when input is invalid.
formstring | undefined—Associated `<form>` id forwarded to the hidden input.
fullWidth systemboolean | undefinedfalseStretch the calendar to the full width of its container.
getDayAriaLabel((date: DateStringValue) => string) | undefined—Assigns each `Day` an `aria-label` based on its date.
getDayProps((date: DateStringValue) => Partial<DayProps>) | undefined—Passes props down to every `Day` (wins over `styles.day`).
getMonthControlProps((date: DateStringValue) => Partial<PickerControlProps>) | undefined—Passes props down to each month `PickerControl`, keyed by date (wins over `styles.control`).
getYearControlProps((date: DateStringValue) => Partial<PickerControlProps>) | undefined—Passes props down to each year `PickerControl`, keyed by date (wins over `styles.control`).
headerControlsOrderCalendarHeaderControlName[] | undefined['previous', 'level', 'next']Order in which the controls are rendered.
hideOutsideDatesboolean | undefinedfalseHide days outside the current month.
hideWeekdaysboolean | undefinedfalseHide the weekday header row.
highlightTodayboolean | undefinedfalseHighlight today with a border.
labelReactNode—Field label rendered above the trigger.
labelSeparatorstring | undefined—Separator rendered between the two dates of a range value.
levelCalendarLevel | undefined—Current displayed level in controlled mode.
localestring | undefined—dayjs locale; falls back to the value defined in `DatesProvider`.
maxDatestring | Date | undefined—Maximum possible date in `YYYY-MM-DD` format or a `Date` object.
maxLevelCalendarLevel | undefined'decade'Max level the user can zoom out to.
minDatestring | Date | undefined—Minimum possible date in `YYYY-MM-DD` format or a `Date` object.
modalPropsPartial<Omit<ModalProps, "children">> | undefined—Props passed to the `Modal` when `dropdownType="modal"` (ignored for the `popover` dropdown). Spread before the component's own `opened`/`onClose`/ `title`, so those always win; the `withCloseButton={false}` default is overridable via `modalProps.withCloseButton`.
monthLabelFormatDateLabelFormat | undefined'MMMM YYYY'dayjs format for the month label, or a function returning it.
monthsListFormatstring | undefined'MMM'dayjs format for the month labels.
namestring | undefined—Form field name forwarded to the hidden input.
nextIconReactNode—Replace the next-button icon.
nextLabelstring | undefined—Next-button `aria-label`.
numberOfColumnsnumber | undefined1Number of columns displayed next to each other.
onChange((value: DateStringValue | null) => void) | undefined—Called when the value changes.
onDateChange((date: DateStringValue) => void) | undefined—Called when the displayed date changes.
onDropdownClose(() => void) | undefined—Called when the dropdown closes, after the incomplete-range reset. Lets a wrapper run extra close-time logic (e.g. `DateTimePicker`'s min/max clamp).
onLevelChange((level: CalendarLevel) => void) | undefined—Called when the displayed level changes.
onMonthMouseEnter((event: unknown, date: DateStringValue) => void) | undefined—Called when the pointer enters a month control (web hover; used for range preview). Cross-platform — the event type is opaque, never a DOM event.
onMonthSelect((date: DateStringValue) => void) | undefined—Called when the user selects a month.
onMouseLeave((event: unknown) => void) | undefined—Called when the pointer leaves the calendar root (web hover; used by range pickers to clear the hover preview). Cross-platform — the event type is opaque, never a DOM event; Tamagui no-ops it on native.
onNextDecade((date: DateStringValue) => void) | undefined—Called when the next-decade button is clicked.
onNextMonth((date: DateStringValue) => void) | undefined—Called when the next-month button is clicked.
onNextYear((date: DateStringValue) => void) | undefined—Called when the next-year button is clicked.
onPreviousDecade((date: DateStringValue) => void) | undefined—Called when the previous-decade button is clicked.
onPreviousMonth((date: DateStringValue) => void) | undefined—Called when the previous-month button is clicked.
onPreviousYear((date: DateStringValue) => void) | undefined—Called when the previous-year button is clicked.
onYearMouseEnter((event: unknown, date: DateStringValue) => void) | undefined—Called when the pointer enters a year control (web hover; used for range preview). Cross-platform — the event type is opaque, never a DOM event.
onYearSelect((date: DateStringValue) => void) | undefined—Called when the user selects a year.
placeholderstring | undefined—Input placeholder shown when there is no value.
popoverPropsPartial<Omit<PopoverProps, "children">> | undefined—Props passed to the `Popover`.
previousIconReactNode—Replace the previous-button icon.
previousLabelstring | undefined—Previous-button `aria-label`.
readOnlyboolean | undefined—Prevent the value from being changed by the user (the dropdown stays closed).
renderDayRenderDay | undefined—Custom renderer for each day's content.
requiredboolean | undefined—Mark the field as required (adds the asterisk to the label).
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined——
size systemCalendarSize | undefined'sm'Trigger / control size.
sortDatesboolean | undefinedtrueSort the selected dates before `onChange` — `multiple` only.
styles systemSlotStyles<DateInputStyles> | undefined—Per-slot style sugar — props spread onto the matching composed part (`wrapper`/`input`/`dropdown`/`calendar`).
theme systemThemeName | null | undefined—Applies a theme to this element
valueDateValue | undefined—Controlled value.
valueFormatstring | undefined'MMMM D, YYYY'`dayjs` format used to display (and parse) the value.
valueFormatterDateFormatter | undefined—Format the selected dates into the trigger string (defaults by picker type).
variant systemInputVariant | undefined'default'Visual variant of the input chrome (`default`/`filled`/`unstyled`).
weekdayFormatDateLabelFormat | undefined'dd'dayjs format for weekday names, or a custom renderer.
weekendDaysDayOfWeek[] | undefined`DatesProvider` ([0, 6])Indices of weekend days.
withCellSpacingboolean | undefinedtrueSeparate controls/rows with spacing.
withTimeboolean | undefinedfalsePreserve the time part of the value (set when `valueFormat` includes time).
withWeekNumbersboolean | undefinedfalseDisplay a leading week-number column.
yearLabelFormatDateLabelFormat | undefined'YYYY'dayjs format for the year label, or a function returning it.
yearsListFormatstring | undefined'YYYY'dayjs format for the year labels.

Style slots

Every part of DateInput can be styled through the styles prop. Explicit props on the component always win over slot styles.

SlotTargets
calendarProps for the inline Calendar inside the dropdown.
dropdownProps for the Popover.Dropdown that holds the calendar.
inputProps for the editable trigger Input.
wrapperProps for the Input.Wrapper (label/description/error surface).
Accessibility & DOM props (2)
PropType
keyKey | null | undefined
refRef<TamaguiElement> | undefined

Plus 495 inherited style props from Box — the full Tamagui/React Native style surface, including token shorthands like p, mx, bg and c. See Tokens for the scales they accept, or the full list.

Edit this page on GitHub