Giter VIP home page Giter VIP logo

react-date-picker's Introduction

Headless React Date Picker

A headless React date picker library for easily integrating date selection into your web applications. This library provides a flexible and highly customizable date picker, giving you complete control over the presentation and interaction with the .

npm

Features

  • Headless: The library is designed to be headless, meaning you have full control over the rendering, styling, and behavior of the date picker.
  • Highly Customizable: Customize the appearance, style, and behavior to seamlessly integrate with your project's design.
  • Internationalization: Supports multiple languages and date formats (powered by DayJS).
  • Lightweight: A small and efficient library with two runtime dependencies:
    • React (obviously) version ^18
    • DayJS

Docs

You can find the docs with reference and better examples at https://date-picker.zuruh.dev

Quick Start

Installation

As said above, this lib requires both react and dayjs.

npm i @zuruuh/react-date-picker dayjs react

We also need some specific dayjs plugin, which you can enable by copy/pasting this

Simple example

import { DatePicker } from "@zuruuh/react-date-picker";
//...
const [selectDate, setSelectedDate] = useState<Dayjs | null>(null);

return (
  <DatePicker.Root selectedDate={date} setSelectedDate={setDate}>
    <DatePicker.Calendar>
      <DatePicker.Week>
        <DatePicker.Day>
          {({ date, onClick }) => (
            <button onClick={onClick}>{date.date()}</button>
          )}
        </DatePicker.Day>
      </DatePicker.Week>
    </DatePicker.Calendar>
  </DatePicker.Root>
);

The above example will generate a flat calendar with no markup other than the buttons. You can customize the markup and styling by adding your own jsx to the example wherever you need it

Contribution

Check the contribution guidelines to contribute to this library.

Special thanks

  • Twemoji for the great SVGs
  • The DayJS team for their awesome library

react-date-picker's People

Contributors

zuruuh avatar

Stargazers

Aghiles Lounis avatar

Watchers

 avatar  avatar

react-date-picker's Issues

Create CI

Setup CI with github actions to run linters and tests

Expose `corners` object in day callback

Expose a corners object with properties to know if the currently rendered day is in the corner of the calendar. This can help when rendering such calendars:
image
(in this example the corners on days 3 and 30, as well as 1,2, and 31)

Write readme

Redact the readme with installation instructions, quick start, link to complete docs

Use css modules for stories examples

When loading multiple stories in a row, all their styles are loaded without removing the previous one; We need to ensure loaded styles only applies to their component

Work on test coverage

Create unit tests for all components
Create feature tests for all config options
Create feature tests for behavior (days are generated correctly, with padding if needed, goto next/previous month works as expected, etc...)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.