npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-infinite-scroll-calendar

v1.5.0

Published

Modern React calendar component with Radix UI-style primitives. Full control over styling and behavior with compound components pattern.

Readme

React Infinite Scroll Calendar

Modern React calendar component with Radix UI-style primitives. Full control over styling and behavior with compound components pattern.

Features

Radix UI-style Primitives - Compound components for maximum flexibility
🎨 Data Attributes - Easy styling with data-selected, data-disabled, data-today
TypeScript First - Complete type safety and IntelliSense support
🖥️ Virtual Scrolling - Smooth infinite scroll with @tanstack/react-virtual
📱 Responsive - Works on desktop and mobile
🌍 i18n Ready - Configurable locales and date formats
🎯 Production Ready - Optimized build without console logs

Installation

npm install react-infinite-scroll-calendar
# or
yarn add react-infinite-scroll-calendar
# or
pnpm add react-infinite-scroll-calendar

Required peer dependencies:

  • react >= 16.8.0
  • react-dom >= 16.8.0

Quick Start

import React, { useState } from 'react';
import { Calendar, DateRange } from 'react-infinite-scroll-calendar';

function MyCalendar() {
  const [dateRange, setDateRange] = useState<DateRange>({ 
    start: null, 
    end: null 
  });

  return (
    <Calendar.Root 
      value={dateRange} 
      onChange={setDateRange}
      selectionMode="range"
      locale="ru-RU"
    >
      {({ state, actions }) => (
        <div className="calendar-container">
          {/* Header with navigation */}
          <Calendar.Header className="calendar-header">
            {({ currentMonth }) => (
              <div>
                <h3>{currentMonth?.monthName}</h3>
                <div>
                  <button onClick={() => actions.setSelectionMode('single')}>
                    Single
                  </button>
                  <button onClick={() => actions.setSelectionMode('range')}>
                    Range
                  </button>
                  <button onClick={actions.clearSelection}>
                    Clear
                  </button>
                </div>
              </div>
            )}
          </Calendar.Header>
          
          {/* Weekday labels */}
          <Calendar.Weekdays className="calendar-weekdays">
            {({ weekdays }) => (
              <div className="weekdays-grid">
                {weekdays.map((day, idx) => (
                  <div key={idx}>{day}</div>
                ))}
              </div>
            )}
          </Calendar.Weekdays>
          
          {/* Scrollable calendar grid */}
          <Calendar.Grid className="calendar-grid">
            {({ months }) => (
              <div>
                {months.map(month => (
                  <Calendar.Month key={`${month.year}-${month.month}`} month={month}>
                    {({ month }) => (
                      <div>
                        <h4>{month.monthName}</h4>
                        <div className="days-grid">
                          {month.days.map((day, idx) => (
                            <Calendar.Day key={idx} date={day}>
                              {({ dayNumber, isDisabled, isSelected, isToday }) => (
                                <button
                                  disabled={isDisabled}
                                  data-selected={isSelected}
                                  data-today={isToday}
                                  data-disabled={isDisabled}
                                >
                                  {dayNumber}
                                </button>
                              )}
                            </Calendar.Day>
                          ))}
                        </div>
                      </div>
                    )}
                  </Calendar.Month>
                ))}
              </div>
            )}
          </Calendar.Grid>

          {/* Selection info */}
          <Calendar.SelectionInfo className="selection-info">
            {({ selectedRange, formatDate }) => (
              <div>
                {selectedRange.start ? (
                  <span>
                    {formatDate(selectedRange.start)}
                    {selectedRange.end && ` — ${formatDate(selectedRange.end)}`}
                  </span>
                ) : (
                  'Select dates'
                )}
              </div>
            )}
          </Calendar.SelectionInfo>
        </div>
      )}
    </Calendar.Root>
  );
}

Styling with Data Attributes

The component provides data attributes for easy CSS styling:

/* Selected dates */
[data-selected] { 
  background: #3b82f6; 
  color: white; 
}

/* Disabled dates */
[data-disabled] { 
  opacity: 0.5; 
  cursor: not-allowed; 
}

/* Today */
[data-today] { 
  outline: 2px solid #fbbf24; 
}

/* In range (for range selection) */
[data-in-range] { 
  background: #dbeafe; 
}

/* Range end dates */
[data-range-end] { 
  background: #1d4ed8; 
  font-weight: bold; 
}

API Reference

Components

  • Calendar.Root - Main wrapper component
  • Calendar.Header - Header with month info and actions
  • Calendar.Weekdays - Weekday labels
  • Calendar.Grid - Scrollable calendar container
  • Calendar.Month - Individual month
  • Calendar.Day - Individual day button
  • Calendar.SelectionInfo - Selection display

Props

CalendarProps

interface CalendarProps {
  selectionMode?: 'single' | 'range';
  defaultValue?: DateRange;
  value?: DateRange;
  onChange?: (value: DateRange) => void;
  minDate?: Date;
  maxDate?: Date;
  disabled?: DisabledDate; // NEW: Flexible date blocking API
  disabledDates?: Date[]; // DEPRECATED: Use 'disabled' instead
  disabledDays?: number[]; // DEPRECATED: Use 'disabled' with dayOfWeek instead
  locale?: string;
  weekStartsOn?: 0 | 1;
  monthNames?: string[];
  dayNames?: string[];
  monthBuffer?: { before: number; after: number };
}

DisabledDate

type DisabledDate = 
  | boolean              // true = disable all, false = disable none
  | Date                 // Disable specific date  
  | Date[]               // Disable array of dates
  | {
      from?: Date;       // Disable range from date (inclusive)
      to?: Date;         // Disable range to date (inclusive)
    }
  | {
      before?: Date;     // Disable dates before specified date
      after?: Date;      // Disable dates after specified date
    }
  | {
      dayOfWeek?: number[]; // Disable specific days of week (0=Sunday, 6=Saturday)
    }

Examples of the Disabled API

// Disable all dates
<Calendar.Root disabled />

// Disable a specific date
<Calendar.Root disabled={new Date(2024, 11, 25)} />

// Disable an array of dates  
<Calendar.Root disabled={[
  new Date(2024, 11, 25), 
  new Date(2024, 11, 31),
  new Date(2025, 0, 1)
]} />

// Disable a range of dates (holiday period)
<Calendar.Root disabled={{ 
  from: new Date(2024, 11, 20), 
  to: new Date(2025, 0, 10) 
}} />

// Disable weekends
<Calendar.Root disabled={{ dayOfWeek: [0, 6] }} />

// Disable dates before today (past dates)
<Calendar.Root disabled={{ before: new Date() }} />

// Disable dates after today (future dates)  
<Calendar.Root disabled={{ after: new Date() }} />

// Disable dates outside a specific range
<Calendar.Root disabled={{ 
  before: new Date(2024, 0, 1), 
  after: new Date(2024, 11, 31) 
}} />

Note: The new disabled prop replaces both disabledDates and disabledDays. The old props are still supported for backward compatibility but are deprecated.

DateRange

interface DateRange {
  start: Date | null;
  end: Date | null;
}

Examples

Check out the /example directory for complete implementation examples including:

  • Primitive Components (Radix Style)
  • Virtual Scrolling Implementation
  • Custom Styling Examples
  • Week Start Configuration

Development

# Clone the repository
git clone https://github.com/monterarty/react-infinite-scroll-calendar.git

# Install dependencies
npm install

# Build the library
npm run build

# Run example
cd example
npm install
npm start

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT © monterarty