# Date Picker
URL: /react/components/date-picker
Source: https://github.com/daangn/seed-design/blob/dev/docs/content/react/components/date-picker.mdx
A component that allows selecting a single date, date range, or multiple dates from a calendar.
사용 가능 버전: @seed-design/react@2.2.0, @seed-design/css@2.4.0
## Preview
```tsx
import { Box, DatePicker } from "@seed-design/react";
export default function DatePickerPreview() {
return (
);
}
```
## Installation
- npm: npm install @seed-design/react @seed-design/css
- pnpm: pnpm add @seed-design/react @seed-design/css
- yarn: yarn add @seed-design/react @seed-design/css
- bun: bun add @seed-design/react @seed-design/css
## Props
### DatePicker
### TwoMonthDatePicker
### WeekDatePicker
### ContinuousDatePicker
## Examples
### Layout
Date Picker is divided into the following public components based on layout.
- `DatePicker`: renders only the actual number of weeks in the current month.
- `TwoMonthDatePicker`: displays two consecutive months horizontally. Previous and next buttons move one month at a time.
- `WeekDatePicker`: displays only one week, and previous and next buttons move one week at a time.
- `ContinuousDatePicker`: virtualizes months within `monthRange` vertically. If `monthRange` is omitted, `yearRange` is converted to a month range. You must specify one of `height`, `minHeight`, or `maxHeight`.
One-month and two-month layouts do not always reserve six-week height; they render only the 4-6 weeks needed for each month.
Date Picker does not restrict fixed or maximum width itself; it fills the width of its parent container. For one-month and two-month layouts, determine the required horizontal size by wrapping it with an appropriately sized container on the screen you are using.
```tsx
"use client";
import {
Box,
ContinuousDatePicker,
DatePicker,
TwoMonthDatePicker,
VStack,
WeekDatePicker,
} from "@seed-design/react";
import { SegmentedControl, SegmentedControlItem } from "seed-design/ui/segmented-control";
import * as React from "react";
const today = { year: 2026, month: 7, day: 30 };
const layoutOptions = [
{ value: "month", label: "한 달" },
{ value: "twoMonths", label: "두 달" },
{ value: "week", label: "한 주" },
{ value: "continuous", label: "연속" },
] as const;
type DatePickerLayout = (typeof layoutOptions)[number]["value"];
export default function DatePickerVisibleRanges() {
const [layout, setLayout] = React.useState("month");
const picker = (() => {
switch (layout) {
case "twoMonths":
return ;
case "week":
return ;
case "continuous":
return (
);
default:
return ;
}
})();
return (
setLayout(value as DatePickerLayout)}
>
{layoutOptions.map((option) => (
{option.label}
))}
{picker}
);
}
```
### Limiting exposed months in continuous calendars
You can limit the first and last months visible by scrolling with `monthRange` on `ContinuousDatePicker`. Both end months are included. If only `yearRange` is passed, it is converted from January of the starting year to December of the ending year. When using both props together, `monthRange` must be within `yearRange`.
`monthRange` determines which months are exposed, and `constraints` determines whether each date can be selected. The example below allows selection only from December 15 to January 14 (30 days later) while also limiting the scroll range to December and January.
```tsx
"use client";
import { Box, ContinuousDatePicker, dateOnOrAfter, dateOnOrBefore } from "@seed-design/react";
const today = { year: 2026, month: 12, day: 15 };
const thirtyDaysLater = { year: 2027, month: 1, day: 14 };
export default function ContinuousDatePickerMonthRange() {
return (
);
}
```
### Selection modes
Based on `selectionMode`, you can select a single date (`single`), date range (`range`), or multiple dates (`multiple`). The default is `single`.
- The value of `single` is `DatePickerDate`.
- `range` returns `{ start }` immediately after selecting a start date, and `{ start, end }` when a end date is selected.
- `multiple` always returns a date array without duplicates in ascending order.
```tsx
"use client";
import {
Box,
DatePicker,
Text,
VStack,
type DatePickerDate,
type DatePickerRangeValue,
} from "@seed-design/react";
import * as React from "react";
const today = { year: 2026, month: 7, day: 30 };
export default function DatePickerSelectionModes() {
const [single, setSingle] = React.useState(today);
const [range, setRange] = React.useState({
start: { year: 2026, month: 7, day: 10 },
end: { year: 2026, month: 7, day: 13 },
});
const [multiple, setMultiple] = React.useState([
{ year: 2026, month: 7, day: 7 },
{ year: 2026, month: 7, day: 14 },
]);
return (
Single
Range
Multiple
);
}
```
### Date selection constraints
`constraints` is an array of functions that determine whether a candidate date can be selected. All functions must return `true` for a date to be selectable. You can write functions directly or combine the following helpers.
- `dateOnOrAfter`, `dateOnOrBefore`: limit the date range inclusively.
- `excludeDates`: excludes dates that cannot be selected, such as reservation dates or holidays. In Range mode, it checks the entire period from start date to candidate end date by default.
- `rangeDayCountAtLeast`, `rangeDayCountAtMost`: limit the number of days including both start and end dates.
- `maxSelectionCount`: limits the maximum number that can be selected in Multiple mode. Deselecting already selected dates is allowed.
Dates that do not meet the criteria can be focused with the keyboard but are in `aria-disabled` state and cannot be selected.
The example below limits the selection range including check-in and check-out to 1-14 days to allow same-day trips, and configures it so that ranges including reservation dates cannot be selected.
```tsx
"use client";
import {
Box,
Text,
TwoMonthDatePicker,
VStack,
excludeDates,
rangeDayCountAtLeast,
rangeDayCountAtMost,
type DatePickerDate,
type DatePickerRangeValue,
} from "@seed-design/react";
import * as React from "react";
const bookedDateKeys = new Set(["2026-07-18", "2026-07-19", "2026-07-25"]);
function toDateKey(date: DatePickerDate) {
return `${date.year}-${String(date.month).padStart(2, "0")}-${String(date.day).padStart(2, "0")}`;
}
const constraints = [
rangeDayCountAtLeast(1),
rangeDayCountAtMost(14),
excludeDates((date) => bookedDateKeys.has(toDateKey(date))),
];
export default function DatePickerReservation() {
const [value, setValue] = React.useState({
start: { year: 2026, month: 7, day: 10 },
});
return (
체크인 {toDateKey(value.start)}
{value.end ? ` · 체크아웃 ${toDateKey(value.end)}` : " · 체크아웃을 선택하세요"}
선택 구간은 체크인·체크아웃을 포함해 1~14일이어야 합니다.
예약 완료일(7월 18일·19일·25일)이 포함된 구간은 선택할 수 없습니다.
);
}
```
### Keep the start date and change only the end date
When modifying an already started period, use `selectionMode="range"` and `rangeStartReadOnly` together. The existing start date is displayed in selected state but cannot be changed, and only dates later than the start date can be selected as the new end date.
`rangeStartReadOnly` requires `value` or `defaultValue` that includes the start date. When used in controlled mode, if the start date passed from outside changes, the new value is reflected in the Date Picker.
The ad period example below shows a situation where the start date is August 7 and today is August 10. Using `dateOnOrAfter` together, already passed dates like August 8 and 9 cannot be selected as the new end date.
```tsx
"use client";
import {
Box,
DatePicker,
Text,
VStack,
dateOnOrAfter,
type DatePickerRangeValue,
} from "@seed-design/react";
import * as React from "react";
const today = { year: 2026, month: 8, day: 10 } as const;
const initialValue: DatePickerRangeValue = {
start: { year: 2026, month: 8, day: 7 },
end: { year: 2026, month: 8, day: 14 },
};
function formatDate(date: DatePickerRangeValue["start"]) {
return `${date.year}.${date.month}.${date.day}`;
}
export default function DatePickerReadOnlyRangeStart() {
const [value, setValue] = React.useState(initialValue);
return (
광고 기간 {formatDate(value.start)}
{value.end ? ` ~ ${formatDate(value.end)}` : ""}
);
}
```
### Display additional information in date cells
When adding information such as price, availability, or congestion while maintaining the basic date number, prioritize using `renderDateCellSupplement`. The function receives the date and formatted date number, as well as selection, today, range, disabled, and focus states.
Use `renderDateCellContent` only when you cannot express something with `renderDateCellSupplement` and need to directly construct all internal content including the date number. This prop is not a general extension point but a low-level escape hatch, and the two props cannot be used simultaneously.
The component continues to own the DOM, ARIA, events, and state background of date cells. Therefore, in both functions, return only the content without creating buttons or `gridcell`. Each week's cell height expands to fit the tallest content. When content overflows horizontally on narrow screens, truncation policies such as `maxLines` are directly applied in the render function.
```tsx
"use client";
import { Box, DatePicker, Text } from "@seed-design/react";
const prices = new Map([
[10, "12만원"],
[11, "9만원"],
[12, "11만원"],
[14, "8만원"],
]);
export default function DatePickerCustomCell() {
return (
(
{isUnavailable ? "선택 불가" : (prices.get(date.day) ?? "예약 가능")}
)}
constraints={[(date) => date.day !== 13]}
/>
);
}
```
### Combining with Time Picker
Date Picker uses `DatePickerDate`, a calendar date that does not interpret time or timezone. Manage state separately from Time Picker's `TimePickerValue`, and combine the two values at the server request or domain model boundary.
For services that require timezone, convert to `CalendarDateTime`, `ZonedDateTime`, or your service's date/time DTO at this point. Passing `CalendarDateTime` to Date Picker itself is not supported because the date selection UI would be unnecessarily coupled to timezone policy.
```tsx
"use client";
import {
Box,
DatePicker,
Text,
TimePicker,
VStack,
type DatePickerDate,
type TimePickerValue,
} from "@seed-design/react";
import * as React from "react";
const TODAY: DatePickerDate = { year: 2026, month: 7, day: 30 };
export default function DatePickerDateAndTime() {
const [date, setDate] = React.useState(TODAY);
const [time, setTime] = React.useState({ hour: 14, minute: 30 });
return (
{date.year}.{date.month}.{date.day}. {String(time.hour).padStart(2, "0")}:
{String(time.minute).padStart(2, "0")}
);
}
```
### Navigate and focus to a date
`viewDate`, `defaultViewDate`, `onViewDateChange` control the currently displayed month, week, and scroll reference point. Since Month is normalized to the first day of the month, use `actionsRef` when specifying a specific date cell as the navigation target.
- `navigateToDate(date)`: navigates to show the date and updates the next Tab entry point but maintains the current DOM focus. This action is recommended for external 'today' buttons.
- `focusDate(date)`: navigates to show the date and places actual DOM focus on the date cell. Used for keyboard shortcuts or actions that explicitly move users into the grid.
```tsx
"use client";
import {
ActionButton,
Box,
DatePicker,
HStack,
type DatePickerActions,
type DatePickerDate,
} from "@seed-design/react";
import * as React from "react";
const today: DatePickerDate = { year: 2026, month: 7, day: 30 };
export default function DatePickerNavigationActions() {
const actionsRef = React.useRef(null);
return (
actionsRef.current?.navigateToDate(today)}
>
오늘로 이동
actionsRef.current?.focusDate(today)}>
오늘에 포커스
);
}
```
### Month and year navigation
Clicking the title switches to a Wheel Picker like Time Picker. The year wheel does not repeat and moves within `yearRange`, while the month wheel repeats. The default value of `yearRange` is 100 years before and after based on `today`.
For Month series, the display reference date is normalized to the first day of the month, and Week to the locale's week start day.
### Locale
The default locale is `ko-KR`. Month, weekday, date, and number notation, as well as the week start day, follow the locale. If `weekStartsOn` is passed, only the week start day is redefined. In RTL locales, left/right arrow keys and previous/next icon directions are also reversed.
Default accessibility names for the root, previous/next buttons, and year/month wheels are provided in Korean and English. If names suitable for your product context are needed, redefine them with `ariaLabels`.
### Accessibility
Date Picker uses the WAI-ARIA Grid pattern. Only one date is in the `tab` order, and arrow keys move between dates.
- `ArrowLeft`, `ArrowRight`: day before/after
- `ArrowUp`, `ArrowDown`: week before/after
- `Home`, `End`: start/end of current week
- `PageUp`, `PageDown`: previous/next of current display unit
- `Shift + PageUp`, `Shift + PageDown`: year before/after
- `Enter`, `Space`: select focused date
If there is an element on the screen that represents the Date Picker's name, it can be connected with `aria-labelledby`. Otherwise, depending on the locale, `"Select date"` or a Korean equivalent is used.