Shadcn.io is not affiliated with official shadcn/ui
Shadcn Calendar
React calendar component for date picking with ranges and keyboard navigation. Built with TypeScript and Tailwind CSS for Next.js using React DayPicker.
Ever watched a user type "31/02/2024" into a date field and wonder why your app crashed? Or had someone enter their birthday as "yesterday"? Text inputs for dates are where good UX goes to die. This shadcn/ui calendar gives users a visual way to pick dates that actually exist.
Calendar showcase
Complete date picker with dropdown navigation:
Built on React DayPicker with full TypeScript types and keyboard navigation. Styled with Tailwind CSS so it matches your design system, not some random jQuery plugin from 2012.
npx shadcn@latest add calendarWhy calendars actually prevent errors
Here's the thing—asking users to type dates is asking for trouble. Different countries use different formats (MM/DD/YYYY vs DD/MM/YYYY vs YYYY-MM-DD). Users make typos. They enter impossible dates like February 30th. They forget leap years exist.
A visual calendar solves all of this. Users see the days, click what they want, done. No format confusion, no invalid dates, no parsing nightmares in your backend. It's not just better UX—it's fewer bugs in production.
This free shadcn calendar handles the complex parts—date math, keyboard navigation, accessibility—while you focus on your business logic. Whether you're building booking systems, form inputs, or scheduling features in your JavaScript apps, calendars that actually work save everyone's sanity.
Common calendar patterns you'll actually use
Date range selection
Perfect for booking systems and reports:
Date picker in popover
Space-efficient for forms:
Form integration
With validation and error handling:
Month and year navigation
Quick jumping for birth dates and historical data:
Features
This free open source calendar component includes everything you need:
- TypeScript-first - Full type safety with Date objects and selections
- React DayPicker powered - Battle-tested calendar logic and accessibility
- Tailwind CSS styled - Customize with utilities, not fighting CSS
- Keyboard navigation - Arrow keys, page up/down, everything works
- Range selection - Pick start and end dates for periods
- Multiple modes - Single date, multiple dates, or date ranges
- Accessible by default - Screen readers announce everything properly
- Mobile optimized - Touch-friendly with proper tap targets
API Reference
Calendar Props
| Prop | Type | Default | Description |
|---|---|---|---|
mode | "single" | "multiple" | "range" | "single" | Selection mode |
selected | Date | Date[] | DateRange | - | Selected date(s) |
onSelect | Function | - | Selection handler |
disabled | Matcher | Matcher[] | - | Dates to disable |
captionLayout | "label" | "dropdown" | "label" | Month/year navigation style |
Date Matchers
Flexible ways to disable dates:
| Type | Example | Use Case |
|---|---|---|
Date | new Date(2024, 11, 25) | Christmas |
DateRange | { from: date1, to: date2 } | Vacation period |
DayOfWeek | { dayOfWeek: [0, 6] } | Weekends |
Function | (date) => date < new Date() | Past dates |
Keyboard Shortcuts
| Key | Action |
|---|---|
Arrow Keys | Navigate dates |
Enter/Space | Select date |
Page Up/Down | Previous/next month |
Shift + Page Up/Down | Previous/next year |
Production tips
Always show today clearly. This free shadcn/ui calendar highlights today by default, but make it obvious. Users orient themselves from "now" and work forwards or backwards. Your React calendar should make today impossible to miss.
Disable what can't be selected. Booking system? Disable past dates. Age verification? Disable future dates. Weekend delivery? Disable Saturdays and Sundays. This TypeScript component makes it easy with matcher functions.
Mobile needs bigger tap targets. Those tiny date numbers look fine on desktop. On mobile? Good luck hitting the right date with a thumb. The calendar adapts, but test on real devices. Your Next.js app should work for fingers, not just mouse cursors.
Consider timezone chaos. User picks "tomorrow" at 11pm their time, but your server thinks it's already tomorrow. Dates are hard. This open source shadcn component gives you Date objects—handle timezones in your logic.
Range selection needs visual feedback. When picking check-in/check-out dates, show the range as users hover. The selected period should be obvious. Your JavaScript calendar should guide users, not confuse them.
Integration with other components
Calendars rarely live alone. Wrap them in Popover components for space-efficient date pickers in your React applications. The trigger button shows the selected date, clicking reveals the calendar.
For forms, combine calendars with Form validation to handle date requirements. This open source pattern ensures users pick valid dates before submission. Add Input components for manual date entry as a fallback—some users prefer typing.
In booking interfaces, pair calendars with Select components for time slots. Your JavaScript components work together—pick a date, then choose available times. The calendar provides the day, other components handle the details.
Questions you might have
Shadcn Button
React button component with variants and loading states. Built with TypeScript and Tailwind CSS for Next.js applications using class-variance-authority.
Shadcn Card
React card component for organizing content with headers, actions, and footers. Built with TypeScript and Tailwind CSS for Next.js with semantic HTML.