PU-DatePicker Component

A customizable and accessible date picker component with support for multiple locales and date restrictions

Usage

Basic Usage

October 2023
MTWThFSSu
PropTypeRequiredDefaultDescription
modelValuestring | nullYes-Selected date in YYYY-MM-DD format
alwaysOpenbooleanNofalseKeeps the date picker always visible
localeen-US | pt-BRNoen-USLocale for month and day names
disabledDatesstring[]No[]Array of disabled dates in YYYY-MM-DD format
disabledRange{ start: string, end: string }NoundefinedRange of disabled dates
disabledbooleanNofalseDisable input
EventDescriptionPayload
update:modelValueEmits when a date is selectedstring | null
  • Base styling with Tailwind:
    .datepicker-input {
      @apply w-full p-2 border-2 border-primary-light-500 
            rounded-lg shadow-md shadow-primary-light-500/20;
    }
    
    .datepicker-header {
      @apply flex justify-between items-center font-bold mb-2;
    }
    
    .datepicker-days button {
      @apply border-none bg-none p-1 cursor-pointer rounded;
    }
    
    .datepicker-days button.selected {
      @apply bg-primary-light-500 text-white;
    }
    
  • Customizable classes:
    .datepicker-container {
      @apply bg-white p-4 rounded-lg shadow-lg;
    }
    
    .datepicker-weekdays {
      @apply grid grid-cols-7 text-center font-medium;
    }
    
  • Multiple locale support (en-US, pt-BR)
  • Disabled dates and date ranges
  • Keyboard navigation
  • Accessible markup
  • Customizable styling
  • Always open mode
  • PUTooltip for popup positioning
  • PUIcon for navigation arrows
  • Tailwind CSS for styling