0.1.3 • Published 2 years ago

wink-react-calendar v0.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

WiNK React Calendar

Yet another calendar React component

wink developer npm

Why should I use it?

  • Get things done quickly with singleSelection and rangeSelection modes ✅
  • Or do your own thing with custom mode and get creative 🎨
  • Calendar events? We've got you covered
  • Responsive and mobile first 📱
  • Continously updated 🔥
  • Layout built with the flexible CSS Grid
  • Built on top of the modern and lightweight Luxon

Demos

Check out the demos here!

Get Started

$ npm i wink-react-calendar

Usage

  1. Import the css module
import 'wink-react-calendar/dist/css/style.css';
  1. Import and use the component
import { CalendarMonth } from 'wink-react-calendar';

...

const [date, setDate] = useState();

...

<CalendarMonth
  mode='singleSelection'
  selectedDate={date}
  onCellClick={setDate}
/>

Props

CalendarMonth

NameTypeDefaultDescription
mode'singleSelection' | 'rangeSelection' | 'custom'undefinedDefine the mode of the calendar
currentMonthTimestampCurrent monthCurrent month visualized on the calendar
classNamestringundefinedCustom class for the outer container
weekDaysExceptionsWeekDay[][]Weekdays to exclude from being rendered
cellsConfigBaseCalendarMonthCellConfig[][]Custom config for any cell based on date
minDateTimestampundefinedDisable any cell which date is before this param
maxDateTimestampundefinedDisable any cell which date is after this param
weeksnumber6Number of weeks to be rendered at the same time
opaqueExtraMonthCellsbooleantrueRender cells which date doesn't belong to current month with a opaque style
borderCurrentDaybooleantrueRender current day with a bordered style
navigateToCorrespondingMonthbooleantrueNavigate to the corresponding month of a cell which date doesn't belong to current month
showWeekDaysLabelsbooleantrueShow weekdays labels on top
onCellClick(date: Timestamp) => voidundefinedTriggered when a cell is clicked
onMonthChange(date: Timestamp) => voidundefinedTriggered when the current month is changed
selectedDateTimestampundefined(singleSelection mode only) The current selected day which by default is shown with an active style
startDateTimestampundefined(rangeSelection mode only) Starting date of the range
endDateTimestampundefined(rangeSelection mode only) Ending date of the range
onSelectStartDate(date?: Timestamp) => voidundefined(rangeSelection mode only) Triggered when first date is selected
onSelectEndDate(date?: Timestamp) => voidundefined(rangeSelection mode only) Triggered when second date is selected

Typescript support

The package comes with types included