Elegant Date Picker Component For Tailwind.css – Tailwind Picker

Description:

Tailwind Picker is a Vue.js date picker component created for Tailwind CSS framework.

More Features:

  • Start/end dates.
  • Custom date format.
  • Supports events.
  • Custom styles.
  • Works as a Nuxtjs plugin.

How to use it:

1. Import the component into your Tailwind project.

import Vue from 'vue'
import VueTailwindPicker from 'vue-tailwind-picker'
Vue.use(VueTailwindPicker);

2. Create a default date picker.

<VueTailwindPicker
    @change="(v) => checkin = v"
  >
  <input type="text" v-mode="checkin"/>
</VueTailwindPicker>
export default {
  components: {
    VueTailwindPicker  
  },
  data(){
    return {
      checkin: '',
    }   
  }
}

3. Customize the styles of the date picker.

<VueTailwindPicker
    :theme="{
      background: '#1A202C',
      text: 'text-white',
      border: 'border-gray-700',
      currentColor: 'text-gray-200',
      navigation: {
        background: 'bg-gray-800',
        hover: 'hover:bg-gray-700',
        focus: 'bg-gray-700',
      },
      picker: {
        rounded: 'rounded-md',
        selected: {
          background: 'bg-teal-400',
          border: 'border-teal-400',
          hover: 'hover:border-teal-400',
        },
        holiday: 'text-red-400',
        weekend: 'text-green-400',
        event: 'bg-blue-500',
      },
      event: {
        border: 'border-gray-700',
      },
    }"
    @change="(v) => checkin = v"
  >
  <input type="text" v-mode="checkin"/>
</VueTailwindPicker>

4. All default props.

startDate: {
  type: String,
  required: false,
  default: dayjs().format('YYYY-MM-DD'),
},
endDate: {
  type: String,
  required: false,
  default: undefined,
},
// Next future
disableDate: {
  type: Array,
  required: false,
  default: () => [],
},
eventDate: {
  type: Array,
  required: false,
  default: () => [],
},
formatDate: {
  type: String,
  required: false,
  default: 'YYYY-MM-DD',
},
// Confused with this
formatDisplay: {
  type: String,
  required: false,
  default: 'YYYY-MM-DD',
},
inline: {
  type: Boolean,
  required: false,
  default: false,
},
// Not make sure with this
tailwindPickerValue: {
  type: String,
  required: false,
  default: '',
},
// Next future
dateRange: {
  type: Boolean,
  required: false,
  default: false,
},
// Next future
autoClose: {
  type: Boolean,
  required: false,
  default: true,
},
theme: {
  type: Object,
  required: false,
  default: () => ({
    background: '#FFFFFF',
    text: 'text-gray-700',
    border: 'border-gray-200',
    currentColor: 'text-gray-200',
    navigation: {
      background: 'bg-gray-100',
      hover: 'hover:bg-gray-200',
      focus: 'bg-gray-200',
    },
    picker: {
      rounded: 'rounded-full',
      selected: {
        background: 'bg-red-500',
        border: 'border-red-500',
        hover: 'hover:border-red-500',
      },
      holiday: 'text-red-400',
      weekend: 'text-green-400',
      event: 'bg-indigo-500',
    },
    event: {
      border: 'border-gray-200',
    },
  }),
}

Preview:

Elegant Date Picker Component For Tailwind.css - Tailwind Picker

Changelog:

v1.1.4 (07/08/2020)

  • SSR support now
  • Support empty initial value

v1.1.3 (07/08/2020)

  • Bugfix

Download Details:

Author: kenhyuwa

Live Demo: https://vue-tailwind-picker.netlify.app/examples/#dark

Download Link: https://github.com/kenhyuwa/vue-tailwind-picker/archive/master.zip

Official Website: https://github.com/kenhyuwa/vue-tailwind-picker

Install & Download:

# Yarn
$ yarn add vue-tailwind-picker

# NPM
$ npm install vue-tailwind-picker --save

You Might Be Interested In:

Add Comment