Mini Calendar Picker
Form
Navigation
Compact calendar with date selection and month navigation.
Preview
Compact calendar with date selection
March 2026
Su
Mo
Tu
We
Th
Fr
Sa
Controlled Component
Manage date state externally
March 2026
Su
Mo
Tu
We
Th
Fr
Sa
Selected: 3/21/2026
Props
Component API reference
| Prop | Type | Default | Description |
|---|---|---|---|
defaultValue | Date | new Date() | Initial selected date (uncontrolled) |
value | Date | — | Controlled selected date |
onValueChange | (date: Date) => void | — | Callback when date is selected |
onMonthChange | (date: Date) => void | — | Callback when month changes |
showTodayButton | boolean | true | Show today button in footer |
showClearButton | boolean | true | Show clear button in footer |
daysOfWeek | string[] | ['Su', 'Mo', ...] | Custom day labels |
className | string | — | Additional CSS classes |
Usage
Import and implementation examples
import { MiniCalendarPicker } from '@/components/ui/mini-calendar-picker'
import { useState } from 'react'
// Basic usage
<MiniCalendarPicker />
// Controlled component
export function MyComponent() {
const [selectedDate, setSelectedDate] = useState(new Date())
return (
<MiniCalendarPicker
value={selectedDate}
onValueChange={(date) => {
setSelectedDate(date)
console.log('Selected:', date)
}}
onMonthChange={(date) => {
console.log('Month changed to:', date)
}}
/>
)
}
// Custom configuration
<MiniCalendarPicker
defaultValue={new Date('2024-01-15')}
showTodayButton={true}
showClearButton={false}
daysOfWeek={['S', 'M', 'T', 'W', 'T', 'F', 'S']}
onValueChange={(date) => console.log('Selected:', date)}
/>Features
Built-in functionality
- Month navigation: Arrow buttons for previous/next month
- Date selection: Visual feedback on selected date
- Today button: Quick access to current date
- Week day display: Customizable day labels (Su-Sa)
- Adjacent month dates: Shows dates from previous/next month
- Clear selection: Optional clear button
- Controlled/uncontrolled: Works in both modes
- Dark mode: Full dark mode support
Accessibility
Accessibility considerations
ARIA Attributes
role="grid" for calendar gridaria-label for navigation buttonsaria-selected for selected datearia-disabled for adjacent month datesKeyboard Navigation
| Key | Action |
|---|---|
| Arrow keys | Navigate between dates |
| Enter | Select focused date |
| Tab | Navigate between controls |
Notes
- Screen readers announce date selection
- Keyboard navigation through calendar grid
- Clear focus indicators on all dates