|
1 |
| -# Still in development |
| 1 | +# React Tailwindcss Datepicker |
2 | 2 |
|
3 |
| -This is simple react package template |
| 3 | +<p align="center"> |
| 4 | + <a href="https://vue-tailwind-datepicker.com" target="_blank"> |
| 5 | + <img alt="React Tailwindcss Datepicker" width="100" style="border-radius: 100%;" src="https://raw.githubusercontent.com/onesine/react-tailwindcss-select/master/assets/img/calendar_logo.svg?raw=true"> |
| 6 | + </a><br><br> |
| 7 | + A modern date range picker component for React using Tailwind 3 and dayjs. Alternative to Litepie Datepicker which uses Vuejs. |
| 8 | +</p> |
4 | 9 |
|
5 |
| -Created with: |
6 |
| -- **React**, |
7 |
| -- **Rollup**, |
8 |
| -- **TypeScript**, |
| 10 | +## Features |
| 11 | +- ✅ Theming options |
| 12 | +- ✅ Dark mode |
| 13 | +- ✅ Single Date |
| 14 | +- ✅ Single date use Range |
| 15 | +- ✅ Shortcuts |
| 16 | +- ✅ TypeScript support |
| 17 | +- ✅ Localization(i18n) |
| 18 | +- ⬜ Disable date |
| 19 | +- ⬜ Custom shortcuts |
| 20 | + |
| 21 | +## Documentation |
| 22 | + |
| 23 | +Go to [full documentation](https://react-tailwindcss-datepicker.com) |
| 24 | + |
| 25 | +## Installation |
| 26 | + |
| 27 | +⚠️ React Tailwindcss Datepicker uses Tailwind CSS 3 (with the [@tailwindcss/forms](https://github.com/tailwindlabs/tailwindcss-forms) plugin) & [Dayjs](https://day.js.org/en/) under the hood to work. |
| 28 | + |
| 29 | +### Install via npm |
| 30 | + |
| 31 | +``` |
| 32 | +$ npm install react-tailwindcss-datepicker |
| 33 | +``` |
| 34 | + |
| 35 | +### Install via yarn |
| 36 | + |
| 37 | +``` |
| 38 | +$ yarn add react-tailwindcss-datepicker |
| 39 | +``` |
| 40 | + |
| 41 | +Make sure you have installed the peer dependencies as well with the below versions. |
| 42 | +``` |
| 43 | +"dayjs": "^1.11.6", |
| 44 | +"react": "^18.2.0" |
| 45 | +``` |
| 46 | + |
| 47 | +## Simple Usage |
| 48 | + |
| 49 | +#### Tailwindcss Configuration |
| 50 | +Add the datepicker to your tailwind configuration using this code |
| 51 | + |
| 52 | +```javascript |
| 53 | +// in your tailwind.config.js |
| 54 | +module.exports = { |
| 55 | + // ... |
| 56 | + content: ["./src/**/*.{js,jsx,ts,tsx}", "./node_modules/react-tailwindcss-datepicker/dist/index.esm.js"], |
| 57 | + // ... |
| 58 | +} |
| 59 | +``` |
| 60 | + |
| 61 | +Then use react-tailwindcss-select in your app: |
| 62 | + |
| 63 | +```jsx |
| 64 | +import React, {useState} from "react"; |
| 65 | +import Datepicker from "react-tailwindcss-datepicker"; |
| 66 | + |
| 67 | +const App = () => { |
| 68 | + const [value, setValue] = useState({ |
| 69 | + startDate: new Date(), |
| 70 | + endDate: new Date().setMonth(11) |
| 71 | + }); |
| 72 | + |
| 73 | + const handleValueChange = (newValue) => { |
| 74 | + console.log("newValue:", newValue); |
| 75 | + setValue(newValue); |
| 76 | + } |
| 77 | + |
| 78 | + return ( |
| 79 | + <div> |
| 80 | + <Datepicker |
| 81 | + value={value} |
| 82 | + onChange={handleValueChange} |
| 83 | + /> |
| 84 | + </div> |
| 85 | + ); |
| 86 | +}; |
| 87 | + |
| 88 | +export default App; |
| 89 | +``` |
| 90 | + |
| 91 | +## Theming options |
| 92 | + |
| 93 | +**Light Mode** |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | +**Dark Mode** |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | +**Supported themes** |
| 102 | + |
| 103 | + |
| 104 | +**Teal themes example** |
| 105 | + |
| 106 | + |
| 107 | +> **Info** |
| 108 | +> |
| 109 | +> 👉 To discover the other possibilities offered by this library, you can consult the [full documentation](https://react-tailwindcss-datepicker.com). |
| 110 | +
|
| 111 | + |
| 112 | +## Contributing |
| 113 | +Got ideas on how to make this better? Open an issue! |
| 114 | + |
| 115 | +## Thanks to |
| 116 | +- [Litepie Datepicker](https://litepie.com/) |
| 117 | +- [React](https://reactjs.org/) |
| 118 | +- [Tailwind CSS](https://tailwindcss.com/) |
| 119 | +- [dayjs](https://day.js.org/) |
| 120 | + |
| 121 | +I thank you in advance for your contribution to this project. |
9 | 122 |
|
10 | 123 | ## License
|
11 |
| -MIT Licensed. Copyright (c) Lewhe Onesine 2022. |
| 124 | +[MIT](LICENSE) Licensed. Copyright (c) Lewhe Onesine 2022. |
0 commit comments