Gathering detailed insights and metrics for tailwind-datepicker-react
Gathering detailed insights and metrics for tailwind-datepicker-react
Gathering detailed insights and metrics for tailwind-datepicker-react
Gathering detailed insights and metrics for tailwind-datepicker-react
A tailwindcss/flowbite datepicker component built as a react component with types
npm install tailwind-datepicker-react
61.3
Supply Chain
88.3
Quality
73.5
Maintenance
100
Vulnerability
98.9
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
160 Stars
198 Commits
68 Forks
4 Watching
3 Branches
22 Contributors
Updated on 08 Oct 2024
Minified
Minified + Gzipped
TypeScript (96.77%)
JavaScript (2.39%)
CSS (0.84%)
Cumulative downloads
Total Downloads
Last day
-10.3%
1,371
Compared to previous day
Last week
-5.5%
7,544
Compared to previous week
Last month
3.1%
33,636
Compared to previous month
Last year
63.4%
394,052
Compared to previous year
1
3
6
A Tailwindcss/Flowbite datepicker component built as a React component with types based on the original datepicker from Flowbite. This component can also be used as a plugin using the Flowbite React library.
Date logic from VanillaJS-datepicker.
1npm install tailwind-datepicker-react
1yarn add tailwind-datepicker-react
tailwind.config.js
file1module.exports = { 2 ... 3 content: [ 4 ... 5 "./node_modules/tailwind-datepicker-react/dist/**/*.js", // <--- Add this line 6 ], 7 8}; 9
1import Datepicker from "tailwind-datepicker-react"
1const options = { 2 title: "Demo Title", 3 autoHide: true, 4 todayBtn: false, 5 clearBtn: true, 6 clearBtnText: "Clear", 7 maxDate: new Date("2030-01-01"), 8 minDate: new Date("1950-01-01"), 9 theme: { 10 background: "bg-gray-700 dark:bg-gray-800", 11 todayBtn: "", 12 clearBtn: "", 13 icons: "", 14 text: "", 15 disabledText: "bg-red-500", 16 input: "", 17 inputIcon: "", 18 selected: "", 19 }, 20 icons: { 21 // () => ReactElement | JSX.Element 22 prev: () => <span>Previous</span>, 23 next: () => <span>Next</span>, 24 }, 25 datepickerClassNames: "top-12", 26 defaultDate: new Date("2022-01-01"), 27 language: "en", 28 disabledDates: [], 29 weekDays: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], 30 inputNameProp: "date", 31 inputIdProp: "date", 32 inputPlaceholderProp: "Select Date", 33 inputDateFormatProp: { 34 day: "numeric", 35 month: "long", 36 year: "numeric" 37 } 38} 39 40const DemoComponent = () => { 41 const [show, setShow] = useState < boolean > false 42 const handleChange = (selectedDate: Date) => { 43 console.log(selectedDate) 44 } 45 const handleClose = (state: boolean) => { 46 setShow(state) 47 } 48 49 return ( 50 <div> 51 <Datepicker options={options} onChange={handleChange} show={show} setShow={handleClose} /> 52 </div> 53 ) 54}
1const options = { 2 title: "Demo Title", 3 autoHide: true, 4 todayBtn: false, 5 clearBtn: true, 6 clearBtnText: "Clear", 7 maxDate: new Date("2030-01-01"), 8 minDate: new Date("1950-01-01"), 9 theme: { 10 background: "bg-gray-700 dark:bg-gray-800", 11 todayBtn: "", 12 clearBtn: "", 13 icons: "", 14 text: "", 15 disabledText: "bg-red-500", 16 input: "", 17 inputIcon: "", 18 selected: "", 19 }, 20 icons: { 21 // () => ReactElement | JSX.Element 22 prev: () => <span>Previous</span>, 23 next: () => <span>Next</span>, 24 }, 25 datepickerClassNames: "top-12", 26 defaultDate: new Date("2022-01-01"), 27 language: "en", 28 disabledDates: [], 29 weekDays: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], 30 inputNameProp: "date", 31 inputIdProp: "date", 32 inputPlaceholderProp: "Select Date", 33 inputDateFormatProp: { 34 day: "numeric", 35 month: "long", 36 year: "numeric" 37 } 38} 39 40const DemoComponent = () => { 41 const [show, setShow] = useState < boolean > false 42 const [selectedDate, setSelectedDate] = (useState < Date) | (null > null) 43 const handleChange = (selectedDate: Date) => { 44 setSelectedDate(selectedDate) 45 console.log(selectedDate) 46 } 47 const handleClose = (state: boolean) => { 48 setShow(state) 49 } 50 51 return ( 52 <div> 53 <Datepicker options={options} onChange={handleChange} show={show} setShow={handleClose}> 54 <div className="..."> 55 <div className="..."> 56 <CalendarIcon /> 57 </div> 58 <input type="text" className="..." placeholder="Select Date" value={selectedDate} onFocus={() => setShow(true)} readOnly /> 59 </div> 60 </Datepicker> 61 </div> 62 ) 63}
disabled
true
true
Today
true
Clear
disabled
disabled
As seen on demo page
As seen on demo page
""
new Date()
en
[]
["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"] - Start at Monday even with another language
date
Same as "inputNameProp"
Select Date
{day: "numeric", month: "long", year: "numeric"}
This project is open-source under the MIT License.
After clone, you can run (separated):
No vulnerabilities found.
No security vulnerabilities found.
flowbite-datepicker
A Tailwind CSS powered datepicker built with vanilla JavaScript and Flowbite
react-tailwindcss-datepicker
A modern React Datepicker using Tailwind CSS 3
react-datepicker
A simple and reusable datepicker component for React
@react-types/datepicker
Spectrum UI components in React