Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

flowbite-datepicker

themesberg727.6kMIT1.3.2

A Tailwind CSS powered datepicker built with vanilla JavaScript and Flowbite

datepicker, tailwind, vanilla, javascript

readme

Flowbite Datepicker - Built with Tailwind CSS

This project is a free and open source datepicker library which uses the utility-first classes from Tailwind and the JavaScript from another open source library called Vanilla JS Datepicker.

This Tailwind CSS Datepicker is part of a larger library of components and interactive elements called Flowbite. Although it can also be used independently from the main library, we encourage you to check out the whole Tailwind components library from Flowbite.

Tailwind CSS Datepicker

Getting started

If you want to use the Tailwind Datepicker plugin using JavaScript you will need to include it into your project via NPM:

npm i flowbite-datepicker --save

After you've installed the NPM library, you will need to import the Datepicker module:

import Datepicker from 'flowbite-datepicker/Datepicker';

Initialize a new element using the Datepicker constructor and optionally add custom options based on your needs:

const datepickerEl = document.getElementById('datepickerId');
new Datepicker(datepickerEl, {
    // options
}); 

If you want to use the Tailwind Date Range Picker you have to import the DateRangePicker module:

import DateRangePicker from 'flowbite-datepicker/DateRangePicker';

Then in the same fashion you can initalize a date range picker component by using the DateRangePicker constructor:

const dateRangePickerEl = document.getElementById('dateRangePickerId');
new DateRangePicker(datepickerEl, {
    // options
}); 

Documentation

Check out the official Tailwind CSS Datepicker Documentation page to learn how to get started by installing and then using this library in your project.

Upgrade to pro

There is also a pro version of FlowBite available featuring more components, an application UI layout, marketing UI pages, e-commerce pages and also Figma design files.

Check it out here: flowbite.com

License

The Tailwind CSS Datepicker is open-source under the MIT License. Find out more by clicking here.

Donations

If you want to help support this project you can send us Bitcoin or Ethereum to the following addresses:

  • Bitcoin address: bc1qmxvck7jnvwmv0z9xv4lcjsf05dja973v2pn7f5
  • Ethereum address: 0xcb97e23EBc2262B2ba93bfC5d1e423e08420cAF6

The money will be used to pay for the hosting plan and other costs that are included to maintain this project.

changelog

changelog

1.1.4

Changes

  • Chnage datepicer.show() to move the focus to the input field if it's not focused
    • Fix #52 — picker shown by calling show() doesn't hide by clicking outside

1.1.3

Bug fixes

  • Fix #51 - TypeError occurs when initial dates are set in the input filed in multidate mode

1.1.2

Bug fixes

  • Fix #48 — inline picker submits form by click on prev/next buttons
  • Fix — date with the name of 30-day month is parsed incorrectly if the current date is the 31st

1.1.1

Bug fixes

  • Fix #46 — date range picker cannot be created when using datepicker-full.min.js
  • Fix #45 - onClickOutside listener calls unfocus() when the input field is not focused

1.1.0

New features

  • Add updateOnBlur option (#13)
  • Add showOnClick option (#21)
    • Along with this, picker element's click handler is changed to keep the focus on input field after auto-hiding on date selection
  • Add pickLevel option (#22, #23)
    • minView feature + comprehensive control on date picking level that works with edit on input field and setDate() call as well
  • Add optional forceRender argument to refresh()API
  • Add setDates() API to DateRangePicker (#27)
  • Add support for package entry points

Bug fixes

  • Fix #33 — the view doesn't go back to the days view after changing the selection by other than mouse operation

Changes

  • Change the edit mode so that it no longer discards unparsed changes when exiting
  • Add shift + arrow key to the key patterns to enter the edit mode
  • Make range highlight between range-start and -end available on all views as well as the days view
  • Revise the cross reference between DateRangePicker and Datepicker instances to make it securely usable in custom event handler, etc.
  • Improve readability of selected date in previous/next month area in the calendar

1.0.3

  • Fix #24 — change event was fired inappropriately through setDate() API call

1.0.2

  • Fix #11, #17, #19 — calendar wasn't redrawn properly in some conditions
  • Fix #3 — keyboard showed up by clicking on a calendar element when disableTouchKeyboard = true

1.0.1

  • Add stylesheet for Foundation
  • Add support for importing js by package name (For rollup, webpack)

1.0

First release