Skip to content

๐Ÿ—“ your go-to calendar library built with React(iCal style). comes with full customizability and fancy default transitions.

Notifications You must be signed in to change notification settings

ifndefdeadmau5/react-go-to-calendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

26 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

react-go-to-calendar

Your go-to calendar library built with React(iCal style). comes with full customizability and fancy sticky animation.

Features

  • โ†•๏ธ Keep Scroll up and down
  • ๐Ÿ“ถ Dynamic cell height
  • ๐Ÿ—“ iCalendar style animation
  • โœ‚๏ธ Provides custom hook so that you can build your own calendar UI from scratch
  • ๐Ÿ›ก Fully typed
  • ๐Ÿงฉ Fully composable

Installation

npm install @ifndefdeadmau5/react-go-to-calendar

Storybook

Link

Usage

To have a simple calendar rendered without any hassle, you'll probably just want to make use of the <Calendar /> component right away.

import {
  Calendar,
} from "@ifndefdeadmau5/react-go-to-calendar";
import "@ifndefdeadmau5/react-go-to-calendar/dist/index.css";

const BasicDemo = () => (
  <Calendar
    style={{
      // you need to specify container's height in order to make it scrollable
      maxHeight: "100vh",
    }}
  >
    {({ days, getDayProps }) =>
      days.map((day, i) => {
        return (
          <CalendarDay
            {...getDayProps(i)}
            key={day.toFormat("yyyy-MM-DD")}
            day={day}
          >
            {/* your custom cell content goes here */}
          </CalendarDay>
        );
      })
    }
  </Calendar>
);

...or, if you do appreciate maximum flexibility, we offer you a fine-grained control over about how all the calendar parts are composed.

import {
  Calendar,
  CalendarDay,
  CalendarContainer,
  CalendarHeaders,
  CalendarMonth,
} from "@ifndefdeadmau5/react-go-to-calendar";
import "@ifndefdeadmau5/react-go-to-calendar/dist/index.css";

const LOOKUP_RANGE = 12;

const Demo = (args) => {
  const [{ months }, setCursor] = useCalendar({
    initialCursor: DateTime.now().minus({ weeks: LOOKUP_RANGE }),
    weeks: LOOKUP_RANGE * 2,
  });

  return (
    <CalendarContainer
      style={{
        maxHeight: "100vh",
      }}
    >
      <CalendarHeaders />
      {months.map((days) => {
        return (
          <CalendarMonth
            key={days?.[0]?.toFormat("yyyy-MM-DD")}
            days={days}
          >
            {({ days }) =>
              days.map((day, i) => {
                return (
                  <CalendarDay
                    key={day.toFormat("yyyy-MM-DD")}
                    day={day}
                    {...getDayProps(i)}
                  />
                );
              })
            }
          </CalendarMonth>
        );
      })}
    </CalendarContainer>
  );
};

License

MIT ยฉ ifndefdeadmau5

About

๐Ÿ—“ your go-to calendar library built with React(iCal style). comes with full customizability and fancy default transitions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages