Knit UI
GitHub

Playground

Loading playground…

Playground
<MonthPickerInput />

Examples

Default

Single month with a label.

Loading example…

DefaultSourceStorybook

Range

Range of months in the trigger.

Loading example…

RangeSourceStorybook

Clearable

Clearable single month.

Loading example…

ClearableSourceStorybook

Custom Format

Custom display format via valueFormat.

Loading example…

Custom FormatSourceStorybook

Modal Dropdown

Presenting the picker in a centered modal instead of a popover.

Loading example…

Modal DropdownSourceStorybook

With Validation

Required field with a description and an error message.

Loading example…

With ValidationSourceStorybook

Props

PropTypeDefaultDescription
allowDeselect(Type extends "default" ? boolean : never) | undefined—Whether the user can deselect a date by clicking it again — `type="default"` only.
allowSingleDateInRange(Type extends "range" ? boolean : never) | undefined—Whether a single day can be selected as a range — `type="range"` only.
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.
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.
defaultValueDatePickerValue<Type, DateValue> | undefined—Default value for uncontrolled component.
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.
formstring | undefined—Associated `<form>` id forwarded to the hidden input.
fullWidth systemboolean | undefinedfalseStretch the list (and its controls) to the full width of its container.
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`).
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`.
monthsListFormatstring | undefined'MMM'dayjs format for the month labels.
namestring | undefined—Form field name forwarded to the hidden input.
nextLabelstring | undefined—Next-button `aria-label`.
numberOfColumnsnumber | undefined1Number of columns displayed next to each other.
onChange((value: DatePickerValue<Type, string>) => void) | undefined—Called when 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: MonthPickerLevel) => void) | undefined—Called when the displayed level changes.
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.
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.
onPreviousYear((date: DateStringValue) => void) | undefined—Called when the previous-year button is clicked.
placeholderstring | undefined—Input placeholder shown when there is no value.
popoverPropsPartial<Omit<PopoverProps, "children">> | undefined—Props passed to the `Popover`.
presetsMonthPickerPreset<Type>[] | undefined—Predefined values to pick from.
previousLabelstring | undefined—Previous-button `aria-label`.
readOnlyboolean | undefined—Prevent the value from being changed by the user (the dropdown stays closed).
refRef<TamaguiElement> | undefined——
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.
theme systemThemeName | null | undefined—Applies a theme to this element
typeDatePickerType | Type | undefined—Picker type: `range`, `multiple` or `default`.
valueDatePickerValue<Type, DateValue> | undefined—Value for controlled component.
valueFormatstring | undefined'MMMM YYYY'`dayjs` format for the displayed 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`).
withCellSpacingboolean | undefinedtrueSeparate controls/rows with spacing.
withTimeboolean | undefinedfalseSerialize the hidden field value with time.
yearLabelFormatDateLabelFormat | undefined'YYYY'dayjs format for the year label, or a function returning it.
yearsListFormatstring | undefined'YYYY'dayjs format for the year labels.

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