Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-3-material-date-picker

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-3-material-date-picker

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
182
decreased by-12.92%
Maintainers
1
Weekly downloads
 
Created
Source

Vue material date picker

A material date picker component for Vue 3.

🚀 Installation

Install using your package manager of choice:

yarn add vue-3-material-date-picker

✨ Features

  • Multiple date selection
  • Customizable and themable
  • Can be changed to any locale on the fly

📺 Demo

https://matija-components.vercel.app/date-picker

⚙️ Usage

Import the component locally or define it globally and include the css file:

<template>
  <div style="display: flex">
    <date-picker
      multiple
      :selected-items-text-formatter="(n) => `${n} dates selected`"
      :first-day-of-week="1"
      :allowed-dates="(date) => parseInt(date.split('-')[2], 10) % 2 === 0"
      :locale="locale"
      v-model="date"
    />
    <div style="margin-left: 30px">
      {{ date }}
      <button @click="changeDate" style="margin-left: 5px">Change</button>
      <button @click="changeLocale" style="margin-left: 5px">
        Change locale
      </button>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import { DatePicker } from "vue-3-material-date-picker";
import "vue-3-material-date-picker/dist/style.css";

const date = ref(new Date().toISOString().substring(0, 10));
const locale = ref("en-US");

const changeDate = () => {
  date.value = "2023-09-23";
};

const changeLocale = () => {
  locale.value = "hr-HR";
};
</script>

📃 Props

NameTypeDefaultDescription
v-modelstring/string[]nullStandard two way input, must be passed as an ISO string (YYYY-mm-dd format e.g. 2023-04-23)
minstring1970-01-01Allowed starting date, must be passed as an ISO string (YYYY-mm-dd format e.g. 2023-04-23)
maxstringCurrent dateAllowed ending date, must be passed as an ISO string (YYYY-mm-dd format e.g. 2023-04-23)
disabledbooleanfalseMakes the component uninteractable
readonlybooleanfalseMakes the component uninteractable, but without the style of the disabled variant
widthnumber/string290pxSets the width of the element - can be provided as a string like "290px" or "290" or a number, defaults to 290px
full-widthbooleanfalseIgnores the previous width prop and sets the width to 100% of the parent container
colorstring#2e79bdColor of the various active component elements
first-day-of-weeknumber/string0Sets the first day of the week, starting with 0 for Sunday
hide-titlebooleanfalseHide the picker title
show-adjacent-monthsbooleanfalseToggles visibility of days from previous and next months
localestringundefinedSets the locale, accepts a string with a BCP 47 language tag e.g. en-us or hr-HR
multiplebooleanfalseAllow the selection of multiple dates
allowed-datesfunction ((date: string) => boolean)nullRestricts which dates can be selected
selected-items-text-formatterfunction ((n: number) => string)Selected ${n} datesFunction for formatting the text for selecting multiple dates
title-text-formatterfunction ((date: string) => string)undefinedFunction for formatting the title text

🎺 Events

NameTypeDescription
change(date: string) => voidTriggered when a date is selected
select:year() => voidTriggered when the user selects the year portion
select:month() => voidTriggered when the user selects the month portion
select:day() => voidTriggered when the user selects the day portion

🧩 Slots

title

Use this slot if you want to override the date picker title, an example being:

<date-picker v-model="date">
  <template
    #title="{
      date,
      selectYears,
      selectMonths,
      selectDays,
    }"
  >
    {{ date }}
  </template>
</date-picker>

There are a few props being exposed:

NameTypeDefaultDescription
datestringnullCurrently selected date
selectYearsfunctionN/AHelper function used for triggering the selection of the years
selectMonthsfunctionN/AHelper function used for triggering the selection of the months
selectDaysfunctionN/AHelper function used for triggering the selection of the days

Keywords

FAQs

Package last updated on 16 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc