Forms

Tailwind CSS Date Picker

Tailwind CSS Date Picker is an advanced date selection component built on top of the Vanilla Calendar Pro library that offers versatile support for various date formats, ranges, and customization options, providing responsive and user-friendly date selection solutions for your web projects.

Default Date Picker

To add a basic date picker with default styling, use the data-kt-date-picker attribute on a container element. The calendar will be initialized automatically when the page loads.

Input Mode

To attach a calendar to an input field, use the data-kt-date-picker-input-mode="true" attribute. The calendar will appear when the input is focused and automatically update the input value when a date is selected.

Basic Input (No Icon)

A simple date picker input without an icon. Use the kt-input class directly on the input element.

Calendar Position

Control the horizontal position of the calendar popup relative to the input using data-kt-date-picker-position-to-input . Available values: left , center , and right .

Custom Date Format

Customize the date format displayed in the input using data-kt-date-picker-date-format . Common formats: DD/MM/YYYY , MM/DD/YYYY , YYYY-MM-DD , DD.MM.YYYY . Supported tokens: YYYY , YY , MM , DD , MMMM (full month), MMM (short month), dddd (full weekday), ddd (short weekday).

Date Range Selection

Enable date range selection with two months displayed side by side using data-kt-date-picker-selection-dates-mode="multiple-ranged" , data-kt-date-picker-type="multiple" , and data-kt-date-picker-display-months-count="2" . Includes Reset and Apply action buttons for user confirmation.

Preselected Date Range

Set default start and end dates for a date range picker using data-kt-date-picker-selected-dates with a JSON array of date strings in YYYY-MM-DD format. Combine with data-kt-date-picker-selection-dates-mode="multiple-ranged" for range selection.

Multiple Dates Selection

Allow users to select multiple individual dates using data-kt-date-picker-selection-dates-mode="multiple" . Combined with data-kt-date-picker-action-buttons="true" to show Reset and Apply buttons, keeping the calendar open until the user confirms their selection.

Min/Max Date Constraints

Set minimum and maximum selectable dates using data-kt-date-picker-date-min and data-kt-date-picker-date-max . Control the visible date range with data-kt-date-picker-display-date-min and data-kt-date-picker-display-date-max .

Disable Past Dates

Disable past dates using data-kt-date-picker-disable-dates-past="true" . This is useful for booking systems or future date selections.

Disable Weekends

Disable specific weekdays using data-kt-date-picker-disable-weekdays . Values: 0 (Sunday) through 6 (Saturday). Use [0, 6] to disable weekends.

Highlight Weekends

Add the vc-highlight-weekends class to the parent container to highlight weekend days (Saturday and Sunday) in a different color. This makes it easier for users to identify non-working days in the calendar.

Time Picker

Enable time selection using data-kt-date-picker-selection-time-mode="12" for 12-hour format or data-kt-date-picker-selection-time-mode="24" for 24-hour format.

24-Hour Time Format

Enable 24-hour time format using data-kt-date-picker-selection-time-mode="24" .

Localization

Set the calendar locale using data-kt-date-picker-locale . Supports any valid locale string like de-AT (German-Austria), fr-FR (French), es-ES (Spanish), etc.

Month Picker

Display a month-only picker using data-kt-date-picker-type="month" . Useful for selecting billing periods or monthly reports.

Year Picker

Display a year-only picker using data-kt-date-picker-type="year" . Useful for selecting fiscal years or annual reports.

Preselected Month & Year

Set the initial month and year view using data-kt-date-picker-selected-month (0-11) and data-kt-date-picker-selected-year .

First Day of Week

Set the first day of the week using data-kt-date-picker-first-weekday . Values: 0 (Sunday) through 6 (Saturday). Default is 0 (Sunday). Use 1 for Monday.

API Interaction

Interact with an initialized date picker instance programmatically using the KTDatePicker API. Use KTDatePicker.getInstance(element) to get the instance, then call methods like getSelectedDates() , show() , hide() , reset() , and getCalendar() to access the underlying vanilla-calendar-pro instance.
Click a button to interact with the date picker
Use the date picker inside a modal dialog. The calendar dropdown will properly position itself within the modal content area. Use data-kt-date-picker-lazy="true" to initialize the picker when the modal opens for better performance.