Skip to content
On this page

Datepicker

Base input type date

Usage

Simple Usage

preview
vue
<template>
  <p-datepicker v-model="value" />
</template>

Placeholder

You can set input placeholder via placeholder props

preview
vue
<template>
  <p-datepicker placeholder="Pick A Date" />
</template>

Display Format

You can date via prop format. default is dd/MM/yyyy

preview
vue
<template>
  <p-datepicker
    v-model="value"
    format="yyyy-MM-dd" />
</template>

Limiting Date

You can limit the date via min or max props

preview
vue
<template>
  <!-- Limit 1 Jan - 31 Dec 2022 -->
  <p-datepicker
    :min="new Date(2022, 0, 1)"
    :max="new Date(2022, 11, 31)" />
</template>

Mode Variant

There 3 available mode: date , month, year. default is date. it will limit user input the date.

for example, mode month make user can only select the month, but can't select what spesific date.

preview
vue
<template>
  <p-datepicker
    format="dd MMM yyyy"
    mode="date" />
  <p-datepicker
    format="MMM yyyy"
    mode="month" />
  <p-datepicker
    format="yyyy"
    mode="year" />
</template>

Disabled State

preview
vue
<template>
  <p-datepicker disabled />
</template>

Readonly state

preview
vue
<template>
  <p-datepicker readonly />
</template>

Error state

preview
vue
<template>
  <p-datepicker error />
</template>

Binding v-model

preview
vue
<template>
  <p-datepicker v-vmodel="value" />
</template>

Result :

-

API

Props

PropsTypeDefaultDescription
modelValueDate-v-model value
placeholderString-Input placeholder
formatStringdd/MM/yyyyDate format
disabledBooleanfalseDisabled state
readonlyBooleanfalseReadonly state
errorBooleanfalseError state
modeString-Calendar mode valid value: date, month, year
maxDate-Maximum date can be selected
minDate-Minimum date can be selected

Slots

NameDescription
There no slots here

Events

NameArgumentsDescription
changeNative Date objectEvent when date selected

See Also

Released under the MIT License.