Skip to main content

API Reference

TypedDateInput Component

PropTypeDefaultDescription
valueDate | undefinedundefinedSelected date value
onChange(date: Date) => voidundefinedCallback when date changes
formatstringMM/DD/YYYYFormat using MM, DD, YYYY with custom seperator
classNamestringundefinedCSS class for styling
...propsInputHTMLAttributes<HTMLInputElement>Any other valid input props except type, onMouseUp, onKeyDown, ref, onBlur, onFocus

useTypedDate Hook

function useDateField(options: {
value?: Date;
onChange?: (date: Date) => void;
format?: string;
}): {
inputProps: {
ref: React.RefObject<HTMLInputElement>;
type: string;
value: string;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
onMouseUp: (e: React.MouseEvent<HTMLInputElement>) => void;
onBlur: (e: React.FocusEvent<HTMLInputElement>) => void,
onFocus: (e: React.FocusEvent<HTMLInputElement>) => void,
};
}