0.1.9 • Published 5 years ago

v-cal-input v0.1.9

Weekly downloads
324
License
MIT
Repository
github
Last release
5 years ago

Vue Calendar Input

npm version

Simple, clean calendar input with single date select, or date range selection.

Demo

Installation

yarn add v-cal-input

or

npm install v-cal-input

Usage

<template>
  <div>
    <h1>Selected Date: {{ date }}</h1>
    <date-picker v-model="date"/>
  </div>
</template>

<script>
  import DatePicker from 'v-cal-input'

  export default {
    name: 'Demo',
    components: { DatePicker },
    data() {
      return { date: null }
    }
  }
</script>

Configuration

props

namedefaultdescription
valuenullthe selected date(s)
width350width of the calendar in px
mode'single''single' or 'range'
panels1number of month panels to display

slots

namedescription
forwardnext button
backwardback button
headerpanel header
dayLabelday of week label
dayday cell

Styling

v-cal-input is designed to be simple to customize. Here's the entire structure of a calendar panel

<ol class="calendar">
  <li class="go"><!-- previous month button --></li>
  
  <li class="month-name"></li>
  
  <li class="go"><!-- next month button --></li>
  
  <li class="day-name"><!-- one for each day of the week --></li>
  
  <li class="day-pad"><!-- blank cells until the 1st of the month --></li>
  
  <li class="day"><!-- one for each day --></li>
  
  <li class="day-pad"><!-- blank cells to fill out the rest of the month --></li>
</ol>

The .day class has the following additional classes added to it based on component state.

classmodedescription
todaybothrepresents the current date
selectedbothcurrently selected
highlightedrangebetween the range of selected cells
firstrangefirst selected in a range
lastrangelast selected in a range
in-rangerangeinside a selected range