View as Markdown

API reference: @salmonui/calendars/date-field

FieldBasePropsinterface

import type { FieldBaseProps } from '@salmonui/calendars/date-field';

Also exported from @salmonui/calendars/date-picker, @salmonui/calendars/time-picker.

interface FieldBaseProps extends GroupProps {
    readonly ref?: Ref<HTMLDivElement>;
    readonly size?: 'sm' | 'md' | 'lg' | undefined;
    readonly label?: ReactNode;
    readonly description?: ReactNode;
    readonly errorMessage?: ReactNode;
    readonly format?: DateFormat;
    readonly hourCycle?: HourCycle;
    readonly locale?: string;
    readonly timeZone?: string;
    readonly inputFormats?: readonly string[];
    readonly parse?: ParseFn;
    readonly strict?: boolean;
    readonly disabled?: boolean;
    readonly readOnly?: boolean;
    readonly required?: boolean;
    readonly invalid?: boolean;
    readonly autoFocus?: boolean;
    readonly name?: string;
    readonly form?: string;
    readonly onFocus?: (event: FocusEvent<HTMLDivElement>) => void;
    readonly onBlur?: (event: FocusEvent<HTMLDivElement>) => void;
    readonly localeText?: Partial<FieldLocaleText>;
    readonly dir?: 'ltr' | 'rtl';
}

Props shared by DateField and TimeField.

FieldBaseProps members (23)
NameSignatureDescription
refoptionalreadonly ref?: Ref<HTMLDivElement>;
sizeoptionalreadonly size?: 'sm' | 'md' | 'lg' | undefined;

Control size: 'sm' 24px, 'md' 32px (default), 'lg' 40px tall; data-size on the group.

labeloptionalreadonly label?: ReactNode;

Visible label above the segments; also names the group.

descriptionoptionalreadonly description?: ReactNode;
errorMessageoptionalreadonly errorMessage?: ReactNode;

Shown when invalid (or a complete value is out of range / disabled).

formatoptionalreadonly format?: DateFormat;

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

hourCycleoptionalreadonly hourCycle?: HourCycle;

'h12' or 'h23'; default from the locale.

localeoptionalreadonly locale?: string;

BCP 47 locale. Default 'en-US'; the host locale is never read.

timeZoneoptionalreadonly timeZone?: string;

IANA zone for Date and offset inputs, and details.epochMilliseconds.

inputFormatsoptionalreadonly inputFormats?: readonly string[];

Extra accepted paste and typed formats (patterns); ISO is always accepted.

parseoptionalreadonly parse?: ParseFn;

Custom text parser, tried last.

strictoptionalreadonly strict?: boolean;

false (default): an out-of-range or disabled value is kept and the field is aria-invalid. true: on blur, incomplete or disabled input reverts to the last valid value and an out-of-range value moves to the nearest bound.

disabledoptionalreadonly disabled?: boolean;
readOnlyoptionalreadonly readOnly?: boolean;
requiredoptionalreadonly required?: boolean;
invalidoptionalreadonly invalid?: boolean;
autoFocusoptionalreadonly autoFocus?: boolean;
nameoptionalreadonly name?: string;

Form field name: a visually hidden input posts the ISO value.

formoptionalreadonly form?: string;
onFocusoptionalreadonly onFocus?: (event: FocusEvent<HTMLDivElement>) => void;

Fires once when focus enters the group.

onBluroptionalreadonly onBlur?: (event: FocusEvent<HTMLDivElement>) => void;

Fires once when focus leaves the group.

localeTextoptionalreadonly localeText?: Partial<FieldLocaleText>;
diroptionalreadonly dir?: 'ltr' | 'rtl';

Direction override; inherited from the document by default.