Command Palette

Search for a command to run...

Docs
Multi Month Calendar

Multi Month Calendar

A calendar component that displays multiple months with year/month dropdowns and range selection support

Loading...

Installation

Usage

import { MultiMonthCalendar } from "@/components/ruixen/multi-month-calendar";
import { useState } from "react";
import { DateRange } from "react-day-picker";
 
export default function App() {
  const [range, setRange] = useState<DateRange | undefined>();
  const [single, setSingle] = useState<Date | undefined>();
 
  return (
    <div className="space-y-6">
      {/* Range Mode */}
      <MultiMonthCalendar
        numberOfMonths={3}
        mode="range"
        selected={range}
        onSelect={(date) => setRange(date)}
      />
 
      {/* Single Mode */}
      <MultiMonthCalendar
        numberOfMonths={2}
        mode="single"
        selected={single}
        onSelect={(date) => setSingle(date)}
      />
    </div>
  );
}

Props

PropTypeDefaultDescription
numberOfMonthsnumber2Number of months to display
mode"single" | "range""single"Selection mode
selectedDate | DateRange | undefined-Selected date(s)
onSelect(date: Date | DateRange | undefined) => void-Callback when date is selected
showOutsideDaysbooleantrueShow days outside current month
classNamestring-Additional CSS classes

Features

  • Multiple Months: Display 2+ months simultaneously
  • Year/Month Dropdowns: Quick navigation to any year/month
  • Dual Mode Support: Single date or range selection
  • Responsive Design: Adapts to different screen sizes
  • Keyboard Navigation: Full keyboard accessibility
  • Custom Styling: Tailwind CSS classes for easy customization