Flatpickr is a lightweight JavaScript library for easy date and time picking, offering sleek design and extensive customization options for web applications.
Note: A CDN link won't work here because we need to modify the default Vendor CSS to fit FlyonUI's design.
3
Step 3: Update Tailwind Configuration
To enable CSS overrides, include the path to the vendor JS files in the content section of your Tailwind configuration file. Additionally, set vendors="true" in the FlyonUI config to ensure the override CSS is generated:
module.exports= {
content: [
'.../path/to/flatpickr/**/*.js', // Include all relevant JS files from Flatpickr
],
flyonui: {
vendors:true// Enable vendor-specific CSS generation
}
}
4
Step 4: Basic Usage
The following are valid ways to create a Flatpickr instance:
// If using Flatpickr in a framework, it's recommended to pass the element directly
flatpickr(element, {});
// Alternatively, selectors are supported
flatpickr("#myID", {});
// Create multiple instances
flatpickr(".anotherSelector");
The date picker below has been localized to display months and days in Russian. For more information, please refer to the official documentation on localization.