shadcn.io is not affiliated with official shadcn/ui
Calendar examples · Standard
Calendar as Appointment Picker for React
A calendar beside a scrolling list of time slots for booking an appointment.
A Calendar and a column of fourteen time slots, from 9:00 AM to 4:30 PM, in one bordered frame. Pick a day, then a slot: the picked slot turns solid. The slots scroll in a Scroll Area that matches the calendar's height. Use it on booking pages where the day and the time are chosen together.
Preview
Installation
FAQ
How do I read the date the person picked?
mode="single" makes selected one date and onSelect the setter. This demo stores that date in state, starting from new Date().
How does a time slot get selected?
Each time is a Button with that string as value. The click handler stores event.currentTarget.value in selectedTime, and that button uses variant="default" while the others stay outline.
Where does the list of times come from?
The times are a fixed availableTimes array: 9:00 AM through 11:30 AM, then 1:00 PM through 4:30 PM, in 30 minute steps. The date handler only updates the date, so the highlighted time stays until a time button is clicked.
How does the time list scroll?
The times column is w-62, filled by an absolute inset-0 wrapper. ScrollArea has min-h-0 flex-1 under the heading Available Times, so the buttons scroll inside the row.
Related
- Calendar with RangeA two-month calendar for selecting a
- Calendar with Month and Year SelectorA calendar with month and year dropdowns
- Date Picker with RangeA date range picker that shows two months
- Calendar with Date and TimeA calendar with a time input under it for
- Calendar with Range in DialogA button that opens a dialog with a
- Calendar with Custom Select Day StyleA calendar with round days that