Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Calendar examples · Standard

Calendar with Multiple Day Selection for React

A calendar that selects several separate days at once.

Framework
UI library

A Calendar in multiple selection mode: each click adds or removes a day. It starts with three days of the current month. Use it for availability, recurring sessions and any set of days that isn't a range.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How do I read the selected days?

mode="multiple" makes selected an array of dates and onSelect the setter. This demo starts with the 6th, the 15th and the 24th of the current month.

Which days start selected?

The 6th, the 15th and the 24th of the current month. State starts as those three dates, and the calendar renders the list its change handler returns.

What wraps the grid?

The Calendar className is rounded-md border. Several days come from the selection prop on that same element.

What does the change handler receive?

onSelect receives the next array of dates, and this demo stores it with setDates.

How are the starting dates built?

selectedDates maps 6, 15 and 24 through new Date(year, month, day).

How many months are on screen?

One. This demo sets no month count, so the grid is a single month with those three days selected.