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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@innei/headless-datepicker

v2.0.2-fork.3

Published

React headless datepicker

Downloads

263

Readme

React Date Picker

npm version npm

The Headless Datepicker is a powerful and flexible tool designed for ReactJS applications. It allows developers to create customizable and visually appealing datepickers with ease. Unlike traditional datepickers, this component is "headless," meaning it provides the core functionality and logic while allowing developers to design their own user interface.

Features

  • Datepicker, Hourpicker, and Calendar Modes: The component supports multiple modes, including datepicker, hourpicker, and calendar modes, allowing users to select dates, hours, or navigate through a full calendar.

  • Headless Design: The component follows a headless architecture, separating the logic from the presentation layer. This enables developers to design and customize the user interface according to their application's specific needs.

  • Multi Picker Support: The component allows for nesting multiple pickers within each other, enabling advanced and complex selection scenarios.

  • Keyboard Navigation: Users can easily navigate and interact with the datepicker using keyboard shortcuts, enhancing accessibility and improving the user experience.

  • Written in TypeScript with Type Support: The component is written in TypeScript, providing strong typing and enabling developers to benefit from type-checking during development.

  • Support for other Calendar Types with Config: The component provides support for other calendar types through configuration options. Developers can customize the calendar type based on their requirements.

  • Built-in Config for Jalali Calendar: The component comes with a built-in configuration for the Jalali calendar, making it easy to implement and use the Jalali calendar system.

Installation

The package can be installed via npm:

npm install @aliakbarazizi/picker --save

Or via yarn:

yarn add @aliakbarazizi/picker

Usage

Import Datepicker component

import { Datepicker } from '@aliakbarazizi/picker';

Basic example

<Datepicker>
  <Datepicker.Input />
  <Datepicker.Picker defaultType="day">
    {({ monthName, hour, minute, year }) => (
      <>
        <Datepicker.Button action="prev">Prev</Datepicker.Button>
        <Datepicker.Button action="next">Next</Datepicker.Button>
        <Datepicker.Items>
          {({ items }) =>
            items.map((item) => (
              <Datepicker.Item key={item.key} item={item} action="close">
                {item.text}
              </Datepicker.Item>
            ))
          }
        </Datepicker.Items>
      </>
    )}
  </Datepicker.Picker>
</Datepicker>

Using other calendar types (e.g., Jalali) with Headless Datepicker

The Headless Datepicker library provides the flexibility to support various calendar types, allowing you to tailor the datepicker based on your specific regional requirements. To use a custom calendar type or the built-in Jalali calendar, follow these simple steps:

Configuration Object

Manually create a configuration object for your desired calendar type or use the internal Jalali configuration provided by the library.

  • For the Jalali calendar:

    import { config } from '@aliakbarazizi/picker/jalali';
  • For custom calendar:

    create a config object base on config

Pass Configuration to Datepicker

Use the config prop to pass your configuration to the Datepicker component.

<Datepicker config={config}>...</Datepicker>

The configuration object should remain unchanged during React re-renders to maintain consistent behavior, and it's recommended to declare it outside the component to avoid unnecessary re-creations.

Documentation

Please see the https://aliakbarazizi.github.io/picker/

License

Licensed under MIT license, see LICENSE for the full license.