Appearance
Multiple Months
Display more than 2 months side by side. Defaults to 2 for range pickers.
import { useState } from "react";import "react-date-range-picker-styled/rdrp-styles.css";import { DateRangePicker } from "react-date-range-picker-styled";
function MultiMonth() { const [value, setValue] = useState<{ start: Date | null; end: Date | null }>({ start: null, end: null, });
return <DateRangePicker value={value} onChange={setValue} numberOfMonths={3} />;}Custom Locale
Use createLocale from the headless package to customize month/day names and UI strings.
import { useState } from "react";import { DateRangePicker } from "react-date-range-picker-styled";import { createLocale } from "react-date-range-picker-headless";import "react-date-range-picker-styled/rdrp-styles.css";
const koLocale = createLocale("ko-KR", { confirm: "확인", cancel: "취소", clear: "초기화", today: "오늘", rangePlaceholder: "날짜 범위 선택", rangeSeparator: " ~ ",});
function CustomLocale() { const [value, setValue] = useState<{ start: Date | null; end: Date | null }>({ start: null, end: null, });
return <DateRangePicker value={value} onChange={setValue} locale={koLocale} />;}Caption Dropdown
Switch from button navigation to dropdown selectors for month and year. Useful for picking dates far from the current month.
import { useState } from "react";import { DateRangePicker } from "react-date-range-picker-styled";import "react-date-range-picker-styled/rdrp-styles.css";
function CaptionDropdown() { const [value, setValue] = useState<{ start: Date | null; end: Date | null }>({ start: null, end: null, });
return ( <DateRangePicker value={value} onChange={setValue} captionLayout="dropdown" fromYear={2020} toYear={2030} /> );}