
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
lonare-react-date-picker
Advanced tools
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 install lonare-react-date-picker
or with yarn:
yarn add lonare-react-date-picker
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.
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 }}
/>
);
}
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 |
<DatePicker setDate={(date) => console.log(date)} />
<DatePicker
dateRangeStart="2023-01-01"
dateRangeEnd="2024-12-31"
setDate={(date) => console.log(date)}
/>
<DatePicker
dateFuture={true}
setDate={(date) => console.log(date)}
/>
<DatePicker
yearRange={{ before: 10, after: 10 }}
setDate={(date) => console.log(date)}
/>
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.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Lonare
If you like this project, please consider giving it a ⭐️ on GitHub!
For bugs and feature requests, please create an issue.
The component uses Tailwind CSS classes which can be overridden using your project's Tailwind configuration.
Yes, the component is compatible with Next.js projects.
Yes, you can integrate it with form libraries like Formik or React Hook Form using the `setDate` prop.
FAQs
A simple React DatePicker component with Tailwind CSS
The npm package lonare-react-date-picker receives a total of 0 weekly downloads. As such, lonare-react-date-picker popularity was classified as not popular.
We found that lonare-react-date-picker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.