Skip to main content

Multiple Mode

Set the mode prop to "multiple" to enable the selection of multiple dates in DayPicker.

<DayPicker mode="multiple" />

Props

Prop NameTypeDescription
selectedDate[] | undefinedThe selected dates.
onSelectOnSelectHandler<Date[] | undefined>Event callback when a date is selected.
minnumberThe minimum number of dates that can be selected.
maxnumberThe maximum number of dates that can be selected.
requiredbooleanMake the selection required.

Use the selected and onSelect props to manage the selected dates:

export function App() {
const [selected, setSelected] = React.useState<Date[] | undefined>();

return (
<DayPicker mode="multiple" selected={selected} onSelect={setSelected} />
);
}

Min and Max Dates

Use the min and max props to limit the number of selectable dates.

<DayPicker mode="multiple" min={2} max={5} />

Required Selection

By setting the required prop, DayPicker ensures that the selected dates cannot be unselected.

<DayPicker mode="multiple" required selected={[new Date()]} />