How to Add Datepicker in Bootstrap 5, 4, and 3

Last Updated on January 16, 2025 by Roshan Parihar

Learn how to add datepicker in Bootstrap 5 and other versions. The short answer is to use the Flatpickr lightweight library. let’s find out some examples.

Add Datepicker in Bootstrap 5

To add datepicker in Bootstrap 5, you can use the flatpickr lightweight library. It is highly customize and works great with Bootstrap as given below.

Test it Live

Output

Add Datepicker in Bootstrap 5

Click the input field given above to see the live preview of the calendar. The calendar is easy to use and select months and years. It also uses the Bootstrap icons library to display the calendar icon with input field.

Create Datepicker in Bootstrap 4

If you want to create a datepicker in Bootstrap 4, you can also use the Flatpickr library. See the example below to learn the method.

Test it Live

Output

Create Datepicker in Bootstrap 4

You can click the input field to see the live preview with datepicker calendar.

It uses the same calendar icon with the input field. However, Bootstrap 4 requires to add extra div with class .input-group-append and .input-group-text to group the calendar with input field.

Date Picker in Bootstrap 3

In Bootstrap 3, you can also use the flatpickr. But, it require a jQuery library to include and work as given below.

Test it Live

Output

Date Picker in Bootstrap 3

When you click the input field given above, you will get the live preview where you will get the calendar to select the date. For combining the calendar icon with the input field, you have to use the class .input-group-addon.

Bootstrap 3 does not work with Javascript and require a latest jQuery library to work with the Flatpickr.