Gathering detailed insights and metrics for react-flatpickr
Gathering detailed insights and metrics for react-flatpickr
Gathering detailed insights and metrics for react-flatpickr
Gathering detailed insights and metrics for react-flatpickr
npm install react-flatpickr
Typescript
Module System
Node Version
NPM Version
97.2
Supply Chain
98.9
Quality
86.5
Maintenance
100
Vulnerability
100
License
TypeScript (89.88%)
CSS (4.9%)
JavaScript (3.65%)
HTML (1.57%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
613 Stars
194 Commits
115 Forks
7 Watchers
1 Branches
38 Contributors
Updated on May 12, 2025
Minified
Minified + Gzipped
Latest Version
4.0.10
Package Id
react-flatpickr@4.0.10
Unpacked Size
32.68 kB
Size
9.40 kB
File Count
8
NPM Version
10.9.2
Node Version
23.10.0
Published on
Apr 28, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
36
Flatpickr for React.
This package can be install with yarn
or npm
npm
1npm install --save react-flatpickr
yarn
1yarn add react-flatpickr
1// Keep in mind that these are the styles from flatpickr package 2// See troubleshooting section in case you have problems importing the styles 3 4import "flatpickr/dist/themes/material_green.css"; 5 6import Flatpickr from "react-flatpickr"; 7import { Component } from "react"; 8 9class App extends Component { 10 constructor() { 11 super(); 12 13 this.state = { 14 date: new Date() 15 }; 16 } 17 18 render() { 19 const { date } = this.state; 20 return ( 21 <Flatpickr 22 data-enable-time 23 value={date} 24 onChange={([date]) => { 25 this.setState({ date }); 26 }} 27 /> 28 ); 29 } 30}
string
| optional
This is the default value that will be passed to the inner input
string || array || object || number
| optional
Same as below
Object
| optional
Flatpickr options
: you can pass all Flatpickr parameters
here.Flatpickr
hooks can be passed within this option too.Example:
1<Flatpickr options={{ minDate: "2017-01-01" }} />
node
| optional
This option is closely related with the wrap option from Flatpickr
, please refer to the former link for more information.
string
| optional
Custom className that will be applied to the inner input
element. In case you need to modify the rendered input
styles this is the prop
you should use.
The following props
are provided in order to customize the Flatpickr's functions
default behaviour. Please refer to the Events & Hooks section from Flatpickr
library.
function
| optional
function
| optional
function
| optional
function
| optional
function
| optional
function
| optional
function
| optional
function
| optional
function
| optional
function
| optional
Use this prop
if you want to render
your custom component, this is a Render props pattern.
Example usage:
1 import React from 'react'; 2 import Flatpickr from 'react-flatpickr'; 3 4 const CustomInput = ({ value, defaultValue, inputRef, ...props }) => { 5 return <input {...props} defaultValue={defaultValue} ref={inputRef} />; 6 }; 7 8 export default function App { 9 return ( 10 <Flatpickr 11 render={ 12 ({defaultValue, value, ...props}, ref) => { 13 return <CustomInput defaultValue={defaultValue} inputRef={ref} /> 14 } 15 } 16 /> 17 ) 18 }
You can directly manipulate the flatpickr
instance using the flatpickr
property on the component.
Example:
1 import React, { useRef } from "react"; 2 import Flatpickr from "react-flatpickr"; 3 4 import "flatpickr/dist/flatpickr.css"; 5 6 export default function App() { 7 const fp = useRef(null); 8 9 return ( 10 <div> 11 <Flatpickr ref={fp} /> 12 <button 13 type="button" 14 onClick={() => { 15 if (!fp?.current?.flatpickr) return; 16 fp.current.flatpickr.clear(); 17 }} 18 > 19 Clear 20 </button> 21 </div> 22 ); 23 }
Please import themes directly from the flatpickr
dependency.
In most cases, you should just be able to
import 'flatpickr/dist/themes/airbnb.css'
, but in some cases npm or yarn may installflatpickr
innode_modules/react-flatpickr/node_modules/flatpickr
. If that happens, removing yournode_modules
dir and reinstalling should put flatpickr in the rootnode_modules
dir, or you can import fromreact-flatpickr/node_modules/flatpickr
manually.
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
30 commit(s) and 8 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 2/24 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More@types/react-flatpickr
TypeScript definitions for react-flatpickr
custom-react-flatpickr
[![NPM version][npm-img]][npm-url] [![License][license-img]][license-url] [![Dependency status][david-img]][david-url]
ns-react-flatpickr
flatpickr for React
rescript-react-flatpickr
Rescript bindings for the react-flatpickr npm package