View as Markdown

API reference: @salmonui/calendars/date-range-picker

DateRangePickerPropsinterface

import type { DateRangePickerProps } from '@salmonui/calendars/date-range-picker';
interface DateRangePickerProps extends PickerFieldProps, Omit<PickerCalendarProps, 'focusedValue' | 'defaultFocusedValue'> {
    readonly value?: DateRange<DateInput> | null | undefined;
    readonly defaultValue?: DateRange<DateInput> | null | undefined;
    readonly onValueChange?: ((value: DateRange | null, details: DateRangePickerValueChangeDetails) => void) | undefined;
    readonly onRangeSelect?: ((range: DateRange) => void) | undefined;
    readonly granularity?: 'day' | 'month' | 'year' | undefined;
    readonly min?: DateInput | null | undefined;
    readonly max?: DateInput | null | undefined;
    readonly minDays?: number | undefined;
    readonly maxDays?: number | undefined;
    readonly rangeOverDisabled?: 'block' | 'allow' | undefined;
    readonly presets?: readonly DateRangePreset[] | undefined;
    readonly separator?: ReactNode | undefined;
    readonly confirm?: boolean | undefined;
    readonly visibleMonths?: number | undefined;
    readonly startName?: string | undefined;
    readonly endName?: string | undefined;
    readonly format?: Intl.DateTimeFormatOptions | string | undefined;
    readonly localeText?: Partial<DateRangePickerLocaleText> | undefined;
    readonly ref?: Ref<PickerHandle> | undefined;
}
DateRangePickerProps members (66, 47 inherited)
NameSignatureDescription
disabledoptionalinheriteddisabled?: boolean;
readOnlyoptionalinheritedreadOnly?: boolean;
valueoptionalreadonly value?: DateRange<DateInput> | null | undefined;
defaultValueoptionalreadonly defaultValue?: DateRange<DateInput> | null | undefined;
onValueChangeoptionalreadonly onValueChange?: ((value: DateRange | null, details: DateRangePickerValueChangeDetails) => void) | undefined;
onRangeSelectoptionalreadonly onRangeSelect?: ((range: DateRange) => void) | undefined;

Both ends chosen in the popup, before Apply.

granularityoptionalreadonly granularity?: 'day' | 'month' | 'year' | undefined;
minoptionalreadonly min?: DateInput | null | undefined;
maxoptionalreadonly max?: DateInput | null | undefined;
minDaysoptionalreadonly minDays?: number | undefined;

Shortest and longest allowed span in days, inclusive.

maxDaysoptionalreadonly maxDays?: number | undefined;
rangeOverDisabledoptionalreadonly rangeOverDisabled?: 'block' | 'allow' | undefined;

Whether a range may span isDateDisabled days. Default 'block'.

presetsoptionalreadonly presets?: readonly DateRangePreset[] | undefined;
separatoroptionalreadonly separator?: ReactNode | undefined;

Between the two fields; also splits pasted text. Default an en dash.

confirmoptionalreadonly confirm?: boolean | undefined;

Apply / Cancel in the popup (default true); false commits on the second selection.

visibleMonthsoptionalreadonly visibleMonths?: number | undefined;

Months shown side by side (default 2; one under a narrow container).

startNameoptionalreadonly startName?: string | undefined;

Form names of the two ends; name posts one ISO interval instead.

endNameoptionalreadonly endName?: string | undefined;
formatoptionalreadonly format?: Intl.DateTimeFormatOptions | string | undefined;
localeTextoptionalreadonly localeText?: Partial<DateRangePickerLocaleText> | undefined;
refoptionalreadonly ref?: Ref<PickerHandle> | undefined;
firstDayOfWeekoptionalinheritedfirstDayOfWeek?: number;
showWeekNumbersoptionalinheritedshowWeekNumbers?: boolean;
weekRuleoptionalinheritedweekRule?: WeekRule;
weekdayFormatoptionalinheritedweekdayFormat?: WeekdayFormat;
calendaroptionalinheritedcalendar?: string;

Intl calendar id ('gregory', 'islamic-umalqura', 'japanese', ...).

showTodayButtonoptionalinheritedshowTodayButton?: boolean;
showOutsideDaysoptionalinheritedshowOutsideDays?: boolean;
isDateDisabledoptionalinheritedisDateDisabled?: ((date: PlainDate) => boolean);
renderDayoptionalinheritedrenderDay?: ((ctx: CalendarDayContext) => ReactNode);
getDayPropsoptionalinheritedgetDayProps?: ((ctx: CalendarDayContext) => CalendarDayProps | undefined);
viewoptionalinheritedview?: CalendarView;
defaultViewoptionalinheriteddefaultView?: CalendarView;
onViewChangeoptionalinheritedonViewChange?: ((view: CalendarView) => void);
onFocusedValueChangeoptionalinheritedonFocusedValueChange?: ((date: PlainDate) => void);
openoptionalinheritedopen?: boolean;
defaultOpenoptionalinheriteddefaultOpen?: boolean;
onOpenChangeoptionalinheritedonOpenChange?: ((open: boolean, details: PickerOpenChangeDetails) => void);
popupModeoptionalinheritedpopupMode?: PopupMode;
openOnFocusoptionalinheritedopenOnFocus?: boolean;

Opens the popup when focus enters the field.

editableoptionalinheritededitable?: boolean;

false makes the segments read-only; a click on the field opens the popup.

clearableoptionalinheritedclearable?: boolean;

Renders a clear button.

onClearoptionalinheritedonClear?: (() => void);
strictoptionalinheritedstrict?: boolean;

Out-of-range values move to the nearest bound and disabled or unparsable input reverts on blur.

requiredoptionalinheritedrequired?: boolean;
invalidoptionalinheritedinvalid?: boolean;
labeloptionalinheritedlabel?: ReactNode;
descriptionoptionalinheriteddescription?: ReactNode;
errorMessageoptionalinheritederrorMessage?: ReactNode;
placeholderoptionalinheritedplaceholder?: string;

Watermark shown while empty and not focused.

nameoptionalinheritedname?: string;
formoptionalinheritedform?: string;
autoFocusoptionalinheritedautoFocus?: boolean;
onFocusoptionalinheritedonFocus?: ((event: FocusEvent<Element, Element>) => void);

Focus entered the field group (once).

onBluroptionalinheritedonBlur?: ((event: FocusEvent<Element, Element>) => void);

Focus left the field group and its popup (once).

onInvalidoptionalinheritedonInvalid?: (() => void);

The form value input failed constraint validation.

localeoptionalinheritedlocale?: string;

BCP 47 locale; default 'en-US'.

timeZoneoptionalinheritedtimeZone?: string;

IANA time zone for instant values (Date, ISO with an offset).

hourCycleoptionalinheritedhourCycle?: "h12" | "h23";
sizeoptionalinheritedsize?: "lg" | "md" | "sm";

Control size: 'sm' 24px, 'md' 32px (default), 'lg' 40px tall.

idoptionalinheritedid?: string;
classNameoptionalinheritedclassName?: string;
styleoptionalinheritedstyle?: CSSProperties;
aria-labeloptionalinheritedaria-label?: string;
aria-labelledbyoptionalinheritedaria-labelledby?: string;
aria-describedbyoptionalinheritedaria-describedby?: string;