Update v4.2 - New components, 10+ framework guides, and quality improvements. Visit Changelog

Tailwind CSS Datepicker JavaScript Plugin

Build functional Tailwind CSS datepickers with Preline UI, including single dates, ranges, time selection, inline calendars, presets, and JavaScript methods.

Requires Additional Installation

Note that this component requires the use of the third-party Vanilla Calendar Pro plugin.

Requires JS

Note that this component requires the use of our Advanced Datepicker plugin, else you can skip this message if you are already using Preline UI as a package.

Installation

  1. Install Vanilla Calendar Pro

    Install Vanilla Calendar Pro via npm

    Terminal
                              
                                npm i vanilla-calendar-pro
                              
                            
  2. Add Preline CSS for an Advanced Datepicker

    Import the Preline UI Datepciker CSS file into your Tailwind CSS file. Here's how the full CSS file should look like:

    CSS
                              
                                @import "tailwindcss";
                            
                                /* Preline UI */
                                @import "./node_modules/preline/variants.css";
                                @import "./node_modules/preline/src/plugins/datepicker/styles.css";
    
                                /* Preline Themes */
                                @import "./themes/theme.css";
                              
                            

    If you plan to use Preline with utility-based classes, you should replace styles.css with styles-utility.css.

  3. Add the Vanilla Calendar Pro JavaScript

    Include the JavaScript <script> near the end of your </body> tag:

    HTML
                              
                            

    Certain JavaScript Helpers in Preline UI make use of Lodash plugin. Don't forget to install it, if you haven't done so already: npm i lodash

Basic datepicker

Use the advanced datepicker as a standard single-date picker.

Multiple date selection

Enable selection of multiple dates in the same calendar.

Single-calendar preset ranges

Provide preset ranges while keeping the selection inside a single calendar view.

Date and time

Extend the picker with time selection alongside the chosen date.

Forced light theme

Force the calendar UI to use its light theme regardless of the surrounding page theme.

Date range picker

Configure the datepicker to select a start and end date as a range.

Preset ranges

Offer predefined ranges for quick selection alongside manual date-range picking.

Date range with time

Combine date-range selection with time inputs for both start and end values.

Inline datepicker

Render the calendar inline instead of inside a popover, with range and time controls visible.

Default calendar controls

Use the built-in month and year controls provided by the calendar.

Custom select styling

Apply custom styles to the month and year select controls inside the calendar.

Navigation controls

Add previous, next, and Today controls for quicker calendar navigation.

Use the advanced datepicker inside a modal without changing the interaction pattern.

Destroy and reinitialize

Use the destroy method to remove a datepicker instance, then initialize it again when needed.

© 2026 Preline Labs.