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

lonare-react-date-picker

v1.3.0

Published

A simple React DatePicker component with Tailwind CSS

Downloads

19

Readme

Lonare React Date Picker

A modern, customizable date picker component for React applications, built with Tailwind CSS. This component provides an intuitive interface for date selection with various configuration options.

NPM Version

License

Bundle Size

Demo GIF

Features

  • 📅 Clean and intuitive interface
  • 🎨 Styled with Tailwind CSS
  • 📱 Responsive design
  • 🔧 Highly customizable
  • 🎯 Date range restrictions
  • 🚀 Easy to implement
  • ⚡ Lightweight

Installation

npm install lonare-react-date-picker

or with yarn:

yarn add lonare-react-date-picker

Prerequisites

This package requires the following peer dependencies:

{
  "react": ">=16.8.0",
  "react-dom": ">=16.8.0",
  "@heroicons/react": ">=2.0.0"
}

Make sure you have Tailwind CSS configured in your project.

Usage

import { DatePicker } from 'lonare-react-date-picker';

function App() {
  const handleDateChange = (date) => {
    console.log('Selected date:', date);
  };

  return (
    <DatePicker 
      setDate={handleDateChange}
      yearRange={{ before: 5, after: 5 }}
    />
  );
}

Screenshot

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | default_date | Date \| string | new Date() | Initial date to display | | align | 'left' \| 'right' | 'left' | Alignment of the date picker dropdown | | defaultYear | number | null | Pre-selected year | | defaultMonth | number | null | Pre-selected month (0-11) | | setDate | function | undefined | Callback function when date is selected | | dateFuture | boolean | false | Only allow future dates | | datePast | boolean | false | Only allow past dates | | dateRangeStart | Date \| string | null | Start date for range restriction | | dateRangeEnd | Date \| string | null | End date for range restriction | | yearRange | object | { before: 0, after: 5 } | Number of years to show before/after current year |

Examples

Basic Usage

<DatePicker setDate={(date) => console.log(date)} />

With Date Range Restriction

<DatePicker 
  dateRangeStart="2023-01-01"
  dateRangeEnd="2024-12-31"
  setDate={(date) => console.log(date)}
/>

Future Dates Only

<DatePicker 
  dateFuture={true}
  setDate={(date) => console.log(date)}
/>

Custom Year Range

<DatePicker 
  yearRange={{ before: 10, after: 10 }}
  setDate={(date) => console.log(date)}
/>

Styling

The component uses Tailwind CSS classes for styling. You can override the default styles by wrapping the component in a parent element with custom Tailwind classes.

Browser Support

  • Chrome (and Chromium based browsers)
  • Firefox
  • Safari
  • Edge

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
  3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
  4. Push to the branch (`git push origin feature/AmazingFeature`)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Lonare

Acknowledgments

  • Built with React
  • Styled with Tailwind CSS
  • Icons from Heroicons

Changelog

1.0.0

  • Initial release
  • Basic date picker functionality
  • Tailwind CSS styling
  • Date range restrictions
  • Year range customization

Support

If you like this project, please consider giving it a ⭐️ on GitHub!

For bugs and feature requests, please create an issue.

FAQ

How do I customize the styling?

The component uses Tailwind CSS classes which can be overridden using your project's Tailwind configuration.

Can I use this with Next.js?

Yes, the component is compatible with Next.js projects.

Does it support form libraries?

Yes, you can integrate it with form libraries like Formik or React Hook Form using the `setDate` prop.