Edit page

Menu

Base on https://hypeserver.github.io/react-date-range/#daterangepicker

Related component

  • Popup
  • Input

Basic usage

Install date-fns

npm install date-fns --save
or
yarn add date-fns
import { DateRangeInput } from '@doopage/react-ui-kit'
import { addDays } from "date-fns";
// import css
import '@doopage/react-ui-kit/dist/doopage-ui-kit.css'
const Example = () => {
return (
<DateRangeInput
label={'select date range'}
onChange={(values) => console.log(values)}
minDate={addDays(new Date(), -30)}
maxDate={addDays(new Date(), 30)}
/>
);
}
export default Example;

Playground

Basic

Advanced

One month

Hide defined range

Control

Properties

Prop nameTypeDefaultRequiredDescription
value[number, number] | undefinedfalse
onChange((arr: [number, number]) => void) | undefinedfalse
inputPropsInputProps | undefinedfalse
loadingboolean | undefinedfalse
helperTextstring | undefinedfalse
errorstring | undefinedfalse
labelstring | undefinedfalse
placeholderstring | undefinedfalse
nativeboolean | undefinedfalse
popupPropsPopupProps | undefinedfalse
dateFormatstring | undefinedfalse
hideDefinedRangeboolean | undefinedfalse
fullWidthboolean | undefinedfalse
disabledboolean | undefinedfalse
classNamestring | undefinedfalse

default:

lang"tr" | "cn" | "jp" | "fr" | "it" | "de" | "ko" | "es" | "ru" | undefinedfalse

Calendar languages. (‘cn’ - Chinese, ‘jp’ - Japanese, ‘fr’ - French, ‘it’ - Italian, ‘de’ - German, ‘ko’ - Korean, ‘es’ - Spanish, ‘ru’ - Russian, ‘tr’ - Turkish) default: none

colorstring | undefinedfalse
keystring | undefinedfalse
autoFocusboolean | undefinedfalse
renderStaticRangeLabel((range: DefinedRange) => Element) | undefinedfalse
staticRangesStaticRange[] | undefinedfalse
inputRangesInputRange[] | undefinedfalse
localeLocale | undefinedfalse

default: enUs from locale. Complete list here https://github.com/Adphorus/react-date-range/blob/next/src/locale/index.js

linkedCalendarsboolean | undefinedfalse

default: false

calendarsnumber | undefinedfalse

default: 2

rangesRange[] | undefinedfalse

default: none

scrollScrollOptions | undefinedfalse

default: { enabled: false }

showSelectionPreviewboolean | undefinedfalse

default: false

twoStepChangeboolean | undefinedfalse

default: false

showMonthArrowboolean | undefinedfalse

default: true

rangedCalendarsboolean | undefinedfalse

default: false

specialDaysDateContainerType[] | undefinedfalse

default: none

monthsnumber | undefinedfalse

default: 1

weekStartsOnnumber | undefinedfalse

default:

showMonthAndYearPickersboolean | undefinedfalse

default: true

rangeColorsstring[] | undefinedfalse

default: []

shownDateDate | undefinedfalse

default:

disabledDatesDate[] | undefinedfalse

default:

disabledDay((date: Date) => boolean) | undefinedfalse

default:

startDatePlaceholderstring | undefinedfalse

default: Early

endDatePlaceholderstring | undefinedfalse

default: Continuous

dateDisplayFormatstring | undefinedfalse

default: MMM d, yyyy

dayDisplayFormatstring | undefinedfalse

default: d

weekdayDisplayFormatstring | undefinedfalse

default: E

monthDisplayFormatstring | undefinedfalse

default: MMM yyyy

directionstring | undefinedfalse

default: vertical

moveRangeOnFirstSelectionboolean | undefinedfalse

default: false

editableDateInputsboolean | undefinedfalse

default: false

focusedRange[number, number] | undefinedfalse

default:

initialFocusedRange[number, number] | undefinedfalse

default: [0, 0]

onRangeFocusChange((focusedRange: [number, number]) => void) | undefinedfalse

default:

previewPreview | undefinedfalse

default:

showPreviewboolean | undefinedfalse

default: true

onPreviewChange((preview: Preview) => void) | undefinedfalse

default:

startDateDate | undefinedfalse

default: today

endDateDate | undefinedfalse

default: today

showDateDisplayboolean | undefinedfalse
formatstring | undefinedfalse

default: DD/MM/YYY

firstDayOfWeeknumber | undefinedfalse
themeCalendarTheme | undefinedfalse
onInit((range: Range) => void) | undefinedfalse

default: none

minDatestring | Date | DateFunc | undefinedfalse

default: none

maxDatestring | Date | DateFunc | undefinedfalse

default: none

classNamesPartial<ClassNames> | undefinedfalse

Custom class names for elements

navigatorRenderer((currentFocusedDate: Date, changeShownDate: (shownDate: Date) => void, props: CommonCalendarProps) => Element) | undefinedfalse

default: none

onShownDateChange((visibleMonth: Date) => void) | undefinedfalse

default: none

dragSelectionEnabledboolean | undefinedfalse

default: true

fixedHeightboolean | undefinedfalse

default: false