Custom Flatpickr - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Custom Flatpickr</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.9/flatpickr.min.css"> <style> /* Base styles for the input field */ .custom-flatpickr { font-family: 'Arial', sans-serif; padding: 10px; font-size: 1.2em; width: 100%; max-width: 300px; border: 2px solid #4CAF50; border-radius: 5px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; margin-left: 40%; margin-top: 200px; } .custom-flatpickr:focus { outline: none; border-color: #2196F3; box-shadow: 0 0 10px rgba(33, 150, 243, 0.5); } /* Custom Flatpickr styles */ .flatpickr-calendar { font-family: 'Arial', sans-serif; border-radius: 10px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); overflow: hidden; width: 330px; } .flatpickr-months { background: linear-gradient(90deg, #4CAF50 0%, #2196F3 100%); color: #fff; padding: 10px; } .flatpickr-days { background: #fff; padding: 10px; } .flatpickr-day { width: 40px; height: 40px; line-height: 40px; margin: 5px; transition: all 0.2s ease; } .flatpickr-day:hover { background: #2196F3; color: #fff; transform: scale(1.1); } .flatpickr-day.today { background: #4CAF50; color: #fff; } .flatpickr-day.selected { background: #FF9800; color: #fff; border-radius: 50%; } .flatpickr-weekday { font-weight: bold; color: #4CAF50; } /* Animations */ @keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } } .flatpickr-calendar { animation: fadeIn 0.3s ease; } /* Icons and Emojis */ .flatpickr-prev-month svg, .flatpickr-next-month svg { fill: #fff; } .flatpickr-prev-month::before, .flatpickr-next-month::before { content: "🗓️"; margin-right: 5px; } </style> </head> <body> <input type="text" id="datepicker" class="custom-flatpickr" placeholder="Pick a date"> <script src="https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.9/flatpickr.min.js"></script> <script> document.addEventListener('DOMContentLoaded', function() { flatpickr("#datepicker", { dateFormat: "Y-m-d", disableMobile: "true", onReady: function(selectedDates, dateStr, instance) { instance.calendarContainer.classList.add('animated', 'fadeIn'); } }); }); </script> </body> </html>