Vue Month Picker

2.0.0 · active · verified Sun Apr 19

vue-month-picker is a lightweight, dependency-free month picker component designed specifically for Vue 3 applications. Currently at version 2.0.0, it offers robust functionality for selecting single months or month ranges without external dependencies, making it a highly performant choice. The library features full TypeScript support, leveraging Vue's Composition API and `<script setup>` syntax for modern Vue development. Key capabilities include inline and input-driven picker modes, date constraints (`minDate`, `maxDate`), customizable date formatting, a dark theme option, year-only selection, and extensive internationalization with over 45 built-in languages. Its focus on Vue 3 and zero dependencies differentiates it from more general-purpose date pickers.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates local component registration for both inline and input-driven month pickers, including basic usage with event handling and range selection.

<script setup lang="ts">
import { MonthPicker, MonthPickerInput } from 'vue-month-picker'
import type { IDateResult } from 'vue-month-picker'

const onDateChange = (date: IDateResult) => {
  console.log('Selected Month:', date.month, 'Year:', date.year)
}

const onRangeChange = (dateRange: { month: number; year: number }[]) => {
  console.log('Selected Range:', dateRange)
}
</script>

<template>
  <h3>Inline Month Picker</h3>
  <MonthPicker @change="onDateChange" />

  <h3>Input Month Picker</h3>
  <MonthPickerInput
    :no-default="true"
    date-format="%n %Y"
    placeholder="Select a month"
    @change="onDateChange"
  />

  <h3>Range Selection Picker</h3>
  <MonthPicker
    :range="true"
    :no-default="true"
    @change="onRangeChange"
  />
</template>

view raw JSON →