reablocks
Version:
Component library for React
51 lines (50 loc) • 1.29 kB
TypeScript
import { FC, ReactElement } from 'react';
import { Placement } from '../../utils/Position';
import { PresetOption } from '../Calendar';
import { InputProps } from '../Input';
import { DateInputTheme } from './DateInputTheme';
export type DateInputProps = Omit<InputProps, 'value' | 'onChange'> & {
/**
* The format in which the date should be displayed.
* @type {string}
* @default 'MM/dd/yyyy'
*/
format?: string;
/**
* Calendar placement type.
* @default 'bottom-start'
*/
placement?: Placement;
/**
* Open calendar on field focus
* @default true
*/
openOnFocus?: boolean;
/**
* Preset to show in quick filter.
* @default []
*/
preset?: PresetOption[];
/**
* Custom theme for the date input.
*/
theme?: DateInputTheme;
/**
* Name of the option to open the calendar.
*/
openCalendarOptionName?: string;
/**
* Icon to show in open calendar button.
* @default <CalendarIcon />
*/
icon?: ReactElement;
} & ({
isRange?: true;
value: [Date, Date];
onChange: (value: [Date, Date]) => void;
} | {
isRange?: false;
value: Date;
onChange: (value: Date) => void;
});
export declare const DateInput: FC<DateInputProps>;