react-datepicker-calendar-wealthhealth
v1.0.5
Published
A customizable and easy-to-use date picker component for React
Downloads
5
Maintainers
Readme
DatePicker Component
The DatePicker is a React component that lets users select a date in an intuitive and flexible way.
Features
- Easy date selection
- Quick month and year change
- Button to select current date
- Automatic close when clicked outside calendar
- Customizable style via CSS
Prerequisites
To use the DatePicker
, ensure that your development environment includes:
- Node.js: Required for installing packages from NPM and running build scripts. Compatible with Node.js version 12 or higher.
- React: Designed for React applications. Ensure you have React version 17 or higher installed in your project.
- TypeScript: Since the component is written in TypeScript and exports types, TypeScript 4.0 or higher is required for full compatibility.
Installation
To install the component, use npm or yarn :
npm install react-datepicker-calendar-wealthhealth
or
yarn add react-datepicker-calendar-wealthhealth
Usage
To use the DatePicker in your project, import it and pass it the necessary properties. Here's a basic example:
import DatePicker from 'react-datepicker-calendar-wealthhealth';
import { useState } from 'react';
function MyComponent() {
const [selectedDate, setSelectedDate] = useState(new Date());
const handleDateChange = (newDate) => {
setSelectedDate(newDate);
};
return (
<DatePicker
selectedDate={selectedDate}
onDateChange={handleDateChange}
closeDatePicker={() => console.log('DatePicker closed')}
/>
);
}
Props
The DatePicker
accepts the following props:
selectedDate
: ADate
object representing the currently selected date.onDateChange
: A callback function that is called when a new date is selected. It receives the new date as aDate
object.closeDatePicker
: Function to close the DatePicker.
Customization
The appearance and functionality of the DatePicker can be customized through CSS and additional prop settings. Please refer to the provided CSS module for styling options.
Contributions
Contributions to improve DatePicker are welcome. Please submit issues and pull requests on the repository page.
License
The DatePicker is released under the MIT license. See the LICENSE file for more details.