View as Markdown

API reference: @salmonui/calendars/date-picker

DatePickercomponent

import { DatePicker } from '@salmonui/calendars/date-picker';
function DatePicker(props: DatePickerProps): import("react").JSX.Element;

Props: DatePickerProps

DatePicker props (64)
NameSignatureDescription
readOnlyoptionalinheritedreadOnly?: boolean;
valueoptionalreadonly value?: DateInput | null | undefined;

A PlainDate or PlainDateTime (what onValueChange passes), fields, an ISO string or a Date instant.

defaultValueoptionalreadonly defaultValue?: DateInput | null | undefined;
onValueChangeoptionalreadonly onValueChange?: ((value: PlainDate | PlainDateTime | null, details: DatePickerValueChangeDetails) => void) | undefined;

PlainDate for 'year' | 'month' | 'day', PlainDateTime for 'hour' | 'minute' | 'second'.

granularityoptionalreadonly granularity?: DatePickerGranularity | undefined;

Deepest segment; also the deepest calendar view and the time part. Default 'day'.

minoptionalreadonly min?: DateInput | null | undefined;
maxoptionalreadonly max?: DateInput | null | undefined;
formatoptionalreadonly format?: DateFormat | undefined;

Display format of the field: Intl options, a skeleton ('yMMMd') or a pattern ('dd/MM/yyyy'); the segments follow it.

inputFormatsoptionalreadonly inputFormats?: readonly string[] | undefined;

Extra patterns accepted when typing over or pasting a whole value.

parseoptionalreadonly parse?: ParseFn | undefined;

Custom text parser for paste.

placeholderValueoptionalreadonly placeholderValue?: DateInput | null | undefined;

Segment seed and popup position without a value.

timeStepoptionalreadonly timeStep?: number | undefined;

Minutes between time list options (default 30).

minTimeoptionalreadonly minTime?: TimeInput | null | undefined;

Daily time window.

maxTimeoptionalreadonly maxTime?: TimeInput | null | undefined;
localeTextoptionalreadonly localeText?: Partial<DatePickerLocaleText> | 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);
focusedValueoptionalinheritedfocusedValue?: DateInput;
defaultFocusedValueoptionalinheriteddefaultFocusedValue?: DateInput;
onFocusedValueChangeoptionalinheritedonFocusedValueChange?: ((date: PlainDate) => void);
openoptionalinheritedopen?: boolean;
defaultOpenoptionalinheriteddefaultOpen?: boolean;
onOpenChangeoptionalinheritedonOpenChange?: ((open: boolean, details: PickerOpenChangeDetails) => void);
popupModeoptionalinheritedpopupMode?: PopupMode;
disabledoptionalinheriteddisabled?: boolean;
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;