Command palette

@yasinsensoy/native

React Native · Components

DatePicker

Date picker: tapping the box opens a calendar in a bottom panel on a phone and below the box on a tablet.

11 exports

Live example

The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.

Preview

Type (28102026) or pick from the calendar.

Code

import { Form, DateField, SubmitButton } from "@yasinsensoy/native";

<Form action={formAction} state={state}>
  <DateField label="Due date" name="date" clearable required description="Type (28102026) or pick from the calendar." tooltip="Weekend delivery costs extra."
    min={new Date()}
    messages={{ valueMissing: "Pick a date", rangeUnderflow: "You can't pick a past date" }} />
  <SubmitButton>Submit</SubmitButton>
</Form>

// Server action
async function save(_: unknown, data: FormData) {
  const date = parseISODate(String(data.get("date"))); // Date | undefined
}

Events

  1. Events appear here when you interact with the preview.

Birth date: future disabled, long display

Appointment: with time, 15-minute steps, Sundays disabled

We're closed on Sundays.

Import

import {
  DatePicker,
  DateRangePicker,
  MonthPicker,
  YearPicker,
  TimePicker,
} from "@yasinsensoy/native";

DatePicker

component

Date picker: tapping the box opens a calendar in a bottom panel on a phone and below the box on a tablet. It closes when a day is selected. The value has the same format as on web (ISO day, "2026-10-28"); the box shows it in the language's format.

DatePicker(props: DatePickerProps): ReactElement<unknown, string | JSXElementConstructor<any>>

Examples

<DatePicker label="Date of birth" value={date} onValueChange={setDate} max={new Date()} />

Date range picker: the first tap selects the start, the second the end; the panel closes when the end is selected. The value is { start, end } ISO days.

DateRangePicker(props: DateRangePickerProps): ReactElement<unknown, string | JSXElementConstructor<any>>

Examples

<DateRangePicker label="Stay" value={range} onValueChange={setRange} min={new Date()} maxDays={30} />

MonthPicker

component

Month picker: for fields that do not need a day, like a billing period or a card expiry date. The panel shows the months of the year in a 3×4 grid; tapping the year opens a year grid. The value has the same format as on web ("2026-10").

MonthPicker(props: MonthPickerProps): ReactElement<unknown, string | JSXElementConstructor<any>>

Examples

<MonthPicker label="Period" value={period} onValueChange={setPeriod} max={new Date()} presets={["thisMonth", "lastMonth"]} />

YearPicker

component

Year picker: pages of 12 years in the panel. The value has the same format as on web ("2026").

YearPicker(props: YearPickerProps): ReactElement<unknown, string | JSXElementConstructor<any>>

Examples

<YearPicker label="Model year" value={year} onValueChange={setYear} min={1990} max={new Date()} />

TimePicker

component

Time picker: tapping the box opens hour and minute columns (a bottom panel on a phone, below the box on a tablet). It closes when a minute is picked. The value has the same format as on web ("14:30"); times outside min/max are disabled.

TimePicker(props: TimePickerProps): ReactElement<unknown, string | JSXElementConstructor<any>>

Examples

<TimePicker label="Appointment time" value={time} onValueChange={setTime} min="09:00" max="18:00" minuteStep={15} />

Props of DatePicker (same names as on web).

Extends: FieldProps, Pick<CalendarBaseProps, "min" | "max" | "isDateDisabled" | "weekStartsOn" | "showOutsideDays" | "fixedWeeks" | "marks">

NameTypeDefaultDescription
value?DateInputSelected day (controlled); ISO ("2026-10-28") or a Date. "" for empty.
defaultValue?DateInputInitial day.
onValueChange?(value: string, date: Date | undefined) => voidISO day and Date when the selection changes.
todayButton?booleantrue"Today" button below the calendar.
format?Intl.DateTimeFormatOptions{ day: "numeric", month: "long", year: "numeric" }Format of the date in the box.
placeholder?stringText shown when nothing is selected.
clearable?booleantrueClear button.
open?booleanWhether the calendar is open in controlled use.
onOpenChange?(open: boolean) => voidWhen the calendar opens or closes.
variant?FieldVariant"outline"Field appearance.
aria-label?stringScreen reader name; give it when there is no visible label.
style?StyleProp<ViewStyle>Container style.

Props of DateRangePicker.

Extends: FieldProps, Pick<CalendarBaseProps, "min" | "max" | "isDateDisabled" | "weekStartsOn" | "showOutsideDays" | "fixedWeeks" | "marks">

NameTypeDefaultDescription
value?DateRangeInputSelected range (controlled).
defaultValue?DateRangeInputInitial range.
onValueChange?(range: DateRange) => voidWhen the selection changes; end is empty until the end is selected.
minDays?numberMinimum number of days in the range (both ends included).
maxDays?numberMaximum number of days in the range.
format?Intl.DateTimeFormatOptions{ day: "numeric", month: "long", year: "numeric" }Format of the date in the box.
placeholder?stringText shown when nothing is selected.
clearable?booleantrueClear button.
open?booleanWhether the calendar is open in controlled use.
onOpenChange?(open: boolean) => voidWhen the calendar opens or closes.
variant?FieldVariant"outline"Field appearance.
aria-label?stringScreen reader name; give it when there is no visible label.
style?StyleProp<ViewStyle>Container style.

Preset options in the MonthPicker panel (same as web).

type MonthPreset = "thisMonth" | "lastMonth" | { /** Button text. */ label: ReactNode; /** Month to select (`"2026-10"`, a date) or a function computing it. */ value: DateInput | (() => DateInput); }

Props of MonthPicker (same names as on web).

Extends: FieldProps

NameTypeDefaultDescription
value?DateInputSelected month: "2026-10", a date string or a Date; "" for none.
defaultValue?DateInputInitial month in uncontrolled use.
onValueChange?(value: string, date: Date | undefined) => voidWhen the selection changes, with "YYYY-MM" and the first day of the month ("", undefined when cleared).
min?DateInputEarliest selectable month.
max?DateInputLatest selectable month.
isMonthDisabled?(date: Date) => booleanFunction for months that cannot be selected (with the first day of the month).
monthFormat?"short" | "long" | "numeric""short"Format of the month names in the grid.
format?Intl.DateTimeFormatOptions{ month: "long", year: "numeric" }Display format in the box.
presets?readonly MonthPreset[]Preset options: "thisMonth", "lastMonth" or { label, value }.
currentButton?booleantrue` when there are no `presets"This month" button at the bottom of the panel.
placeholder?stringText shown when nothing is selected.
clearable?booleantrueClear button.
open?booleanWhether the calendar is open in controlled use.
onOpenChange?(open: boolean) => voidWhen the calendar opens or closes.
variant?FieldVariant"outline"Field appearance.
aria-label?stringScreen reader name; give it when there is no visible label.
style?StyleProp<ViewStyle>Container style.

Props of YearPicker (same names as on web).

Extends: FieldProps

NameTypeDefaultDescription
value?YearInputSelected year: 2026, "2026" or a Date; "" for none.
defaultValue?YearInputInitial year in uncontrolled use.
onValueChange?(value: string, year: number | undefined) => voidWhen the selection changes, with "YYYY" and the year number ("", undefined when cleared).
min?YearInputEarliest selectable year.
max?YearInputLatest selectable year.
isYearDisabled?(year: number) => booleanFunction for years that cannot be selected.
currentButton?booleantrue"This year" button at the bottom of the panel.
placeholder?stringText shown when nothing is selected.
clearable?booleantrueClear button.
open?booleanWhether the calendar is open in controlled use.
onOpenChange?(open: boolean) => voidWhen the calendar opens or closes.
variant?FieldVariant"outline"Field appearance.
aria-label?stringScreen reader name; give it when there is no visible label.
style?StyleProp<ViewStyle>Container style.

Props of TimePicker (same names as on web).

Extends: FieldProps

NameTypeDefaultDescription
value?stringSelected time in controlled use ("14:30"); "" for none.
defaultValue?stringInitial time in uncontrolled use.
onValueChange?(value: string) => voidCalled with "HH:mm" when the time changes ("" when cleared).
min?stringEarliest selectable time ("09:00").
max?stringLatest selectable time ("18:00").
minuteStep?number5Step of the minute list (e.g. 15 → 00, 15, 30, 45).
nowButton?booleantrue"Now" button in the panel.
placeholder?stringText shown when nothing is selected.
clearable?booleantrueClear button.
open?booleanWhether the calendar is open in controlled use.
onOpenChange?(open: boolean) => voidWhen the calendar opens or closes.
variant?FieldVariant"outline"Field appearance.
aria-label?stringScreen reader name; give it when there is no visible label.
style?StyleProp<ViewStyle>Container style.