Gathering detailed insights and metrics for @frankleng/react-tailwindcss-datepicker
Gathering detailed insights and metrics for @frankleng/react-tailwindcss-datepicker
Gathering detailed insights and metrics for @frankleng/react-tailwindcss-datepicker
Gathering detailed insights and metrics for @frankleng/react-tailwindcss-datepicker
A tailwindcss/flowbite datepicker component built as a react component with types
npm install @frankleng/react-tailwindcss-datepicker
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
205 Commits
3 Branches
1 Contributors
Updated on 02 Jun 2024
Minified
Minified + Gzipped
TypeScript (96.81%)
JavaScript (2.36%)
CSS (0.83%)
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
100%
4
Compared to previous week
Last month
71.4%
24
Compared to previous month
Last year
0%
151
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 handleClear = () => { 46 console.log('Date is cleared!') 47 } 48 const handleClose = (state: boolean) => { 49 setShow(state) 50 } 51 52 return ( 53 <div> 54 <Datepicker options={options} onChange={handleChange} onClear={handleClear} show={show} setShow={handleClose} /> 55 </div> 56 ) 57}
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.