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

slek

v0.0.4

Published

Calendar component for React.

Readme

image

Slek npm bundle size npm

An unstyled calendar component for React.

Features

  • 🛠️ Customizable
  • 🌟 Lightweight
  • ☝️ 1 dependency
  • ↩️ RTL support

Installation

npm install slek

Usage

import Calendar, {useCalendar} from 'slek';

const { date, setDate } = useCalendar(new Date());

<Calendar date={date} onChange={((d) => setDate(d))}>
  <Calendar.Header>
    <Calendar.Headline />
    <Calendar.NextButton />
    <Calendar.PrevButton />
  </Calendar.Header>
  <Calendar.Grid>
      {(props) => <MyCell>{props.value}</MyCell>}
  </Calendar.Grid>
</Calendar>

API Reference

The Calendar component is composed of several parts. All parts accept basic HTML element props (style, className...), including ref. Each part has a specific data-attribute (starting with slek-) that can be used for easy styling.

Calendar

slek-root - The main component.

| Prop | Type | Default | Description | | --- | --- | --- | --- | | date | Date | Date[] | -- | The date to display in the calendar | | minDate | Date | -- | The minimum date that can be selected | | maxDate | Date | -- | The maximum date that can be selected | | weekStart | number | 0 | The day of the week to start on (0 = Sunday, 1 = Monday...) | | locale | string | "en" | The locale to use for formatting dates | | disabled | boolean | false | Whether the calendar is disabled | | onChange | (date: Date | Date[]) => void | -- | Callback when the date changes |

Under the hood, we are using dayjs to do all the magic, so if you want to change the local make sure to import that locale from the dayjs package. (See more info here)

Header

slek-header - The header wrapper of the calendar, should contain the headline and the navigation buttons.

| Prop | Type | Default | Description | | --- | --- | --- | --- | | ref | React.RefObject | -- | The ref of the header element |

Headline

slek-headline - The headline of the calendar, displays the current month and year.

| Prop | Type | Default | Description | | --- | --- | --- | --- | | monthStyle | "full" | "short" | "full" | The style of the month name | | disableClick | boolean | false | Whether the headline is clickable | | ref | React.RefObject | -- | The ref of the headline element | | onClick | () => void | -- | Callback when the headline is clicked |

NextButton

slek-next-button - The next button of the calendar, navigates to the next month or next 10 years. Can also be used as a wrapper for a custom next button.

| Prop | Type | Default | Description | | --- | --- | --- | --- | | ref | React.RefObject | -- | The ref of the next button element | | onClick | () => void | -- | Callback when the next button is clicked |

PrevButton

slek-prev-button - The previous button of the calendar, navigates to the previous month or previous 10 years. Can also be used as a wrapper for a custom previous button.

| Prop | Type | Default | Description | | --- | --- | --- | --- | | ref | React.RefObject | -- | The ref of the previous button element | | onClick | () => void | -- | Callback when the previous button is clicked |

Grid

slek-grid - The grid of the calendar, contains the cells.

| Prop | Type | Default | Description | | --- | --- | --- | --- | | mode | "single" | "range" | "multiple" | "single" | The selection mode of the calendar | | direction | "ltr" | "rtl" | "ltr" | The direction of the calendar | | weekdayStyle | "full" | "short" | "min" | "min" | The style of the weekday names | | monthStyle | "full" | "short" | "short" | The style of the month name | | showOutsideDates | boolean | true | Whether to show dates from the previous and next months | | ref | React.RefObject | -- | The ref of the grid element |

The children of the Grid component is a render prop that receives the following props:

| Prop | Type | Description | | --- | --- | --- | | value | string | number | The value of the cell | | type | "date" | "month" | "year" | The type of the cell | | outsideDate | boolean | Whether the cell is from the previous or next month | | today | boolean | Whether the cell is today | | disabled | boolean | Whether the cell is disabled | | invalid | boolean | Whether the cell is invalid (based on the min/max dates) | | selected | boolean | Whether the cell is selected | | between | boolean | Whether the cell is between two selected dates (only in range mode) |

Cell

slek-cell - The cell of the calendar, used as a wrapper for a custom cell. For convenience, the Cell includes those data attributes:

| Data attribute | Values | --- | --- | | data-outside-date | "true" | "false" | | data-today | "true" | "false" | | data-disabled | "true" | "false" | | data-invalid | "true" | "false" | | data-selected | "true" | "false" | | data-between | "true" | "false" | | data-type | "date" | "month" | "year" |

Utils

useCalendar

A simple hook that returns the current date and a function to set the date. You can use it to control the date from outside the calendar. The hook accepts an optional initial date. The hook returns an object with the following properties:

| Property | Type | Description | | --- | --- | --- | | date | Date | Date[] | The current date | | setDate | (date: Date | Date[]) => void | A function to set the date | | selectToday | () => void | A function to select today | | selectCustom | (date: Date) => void | A function to select a custom date |

const { date, setDate } = useCalendar();

<Calendar date={date} onChange={(d) => setDate(d)}>
...
</Calendar>

Contributing

If you want to contribute to the development, please follow these steps:

Fork the repository. Create a new branch. Make your changes. Submit a pull request.

License

This project is licensed under the MIT License.