Skip to content
On this page

Date time picker

Basic Usage

The date time picker have several themes: default, transparent

<template>
  <div class="flex">
    <HcDateTimePicker
      v-model="value1"
      label="Default theme"
      placeholder="MM / DD / YYYY"
      class="w-80"
    />

    <HcDateTimePicker
      v-model="value2"
      label="Transparent theme"
      placeholder="MM / DD / YYYY"
      class="w-80 ml-10"
      theme="transparent"
    />
  </div>
</template>

<script lang="ts" setup>
import { HcDateTimePicker } from '@deeepvision/hope-component-kit';
import { ref } from 'vue';

const value1 = ref('');
const value2 = ref('');
</script>

Sizes

The date time pickers have text sizes: small, medium

The date time pickers have sizes: small, medium

<template>
  <div class="">
    <div class="grid grid-cols-2 gap-6 items-start">
      <HcDateTimePicker
        v-model="value1"
        label="Medium text size"
        placeholder="MM / DD / YYYY"
        class="w-80"
        text-size="medium"
      />

      <HcDateTimePicker
        v-model="value2"
        label="Small text size"
        placeholder="MM / DD / YYYY"
        class="w-80"
        text-size="small"
      />
    </div>

    <div class="grid grid-cols-2 gap-6 items-start mt-5">
      <HcDateTimePicker
        v-model="value3"
        label="Medium size"
        placeholder="MM / DD / YYYY"
        class="w-80"
        size="medium"
      />
      <HcDateTimePicker
        v-model="value4"
        label="Small size"
        placeholder="MM / DD / YYYY"
        class="w-full"
        size="small"
      />
    </div>
  </div>
</template>

<script lang="ts" setup>
import { HcDateTimePicker } from '@deeepvision/hope-component-kit';
import { ref } from 'vue';

const value1 = ref('');
const value2 = ref('');
const value3 = ref('');
const value4 = ref('');

</script>

Types

Use props type to determinate type of the picker

<template>
  <div class="grid grid-cols-3 gap-3 items-start">
    <HcDateTimePicker
      v-model="value1"
      label="Date"
      placeholder="MM / DD / YYYY"
      type="date"
    />

    <HcDateTimePicker
      v-model="value2"
      label="Date and time"
      placeholder="MM"
      type="datetime"
    />

    <HcDateTimePicker
      v-model="value3"
      label="Month"
      placeholder="MM"
      type="month"
      format="MMMM"
    />
  </div>
</template>

<script lang="ts" setup>
import { HcDateTimePicker } from '@deeepvision/hope-component-kit';
import { ref } from 'vue';

const value1 = ref('');
const value2 = ref('');
const value3 = ref('');
</script>

States

Use props disabled, readonly or clearable

<template>
  <div class="grid grid-cols-3 gap-3 items-start">
    <HcDateTimePicker
      v-model="value1"
      label="Disabled"
      disabled
    />

    <HcDateTimePicker
      v-model="value2"
      label="Readonly"
      readonly
    />

    <HcDateTimePicker
      v-model="value3"
      label="Clearable"
      clearable
    />
  </div>
</template>

<script lang="ts" setup>
import { HcDateTimePicker } from '@deeepvision/hope-component-kit';
import { ref } from 'vue';

const value1 = ref('');
const value2 = ref('');
const value3 = ref('');

</script>

Error

Use props errorMsg to show error message or use prop boolean error to detarmitate error state of the component

This field is required
<template>
  <div class="grid grid-cols-3 gap-3 items-start">
    <HcDateTimePicker
      v-model="value1"
      label="Error"
      error
    />

    <HcDateTimePicker
      v-model="value2"
      label="Error msg"
      error-msg="This field is required"
    />

    <HcDateTimePicker
      v-model="value3"
      label="Error and disabled"
      error
      disabled
    />
  </div>
</template>

<script lang="ts" setup>
import { HcDateTimePicker } from '@deeepvision/hope-component-kit';
import { ref } from 'vue';

const value1 = ref('');
const value2 = ref('');
const value3 = ref('');
</script>

Props

PropertyType Values Description Default
modelValueStringStringbinding valuefalse
formatStringStringformat of the displayed value in the input boxundefined
sizeStringsmallmediumcomponent sizemedium
textSizeStringsmallmediumcomponent field text sizesmall
clearableBooleanBooleanwhether to show clear buttonfalse
themeStringdefaulttransparentcomponent defaultdefault
labelStringStringlabel text
placeholderStringStringplaceholder textMM/DD/YYYY
typeStringyear/month/date/datetime/ week/datetimerange/daterangetype of the pickerdatetime
disabledDateFunctionFunctionfunction that determining if a date is disabled with that date as its parameter. Should return a Boolean
disabledBooleanBooleanwhether component is disabledfalse
readonlyBooleanBooleanwhether component is read onlyfalse
errorBooleanBooleandetermine if the component has error and change its style to that state.false
errorMsgStringStringerror message

Slots

PropertyType Values Description Default
label-suffix-customize label suffix content

Events

PropertyType Values Description Default
update:model-valueFunctionvalue - stringtriggers when the binding value changes
changeFunctionvalue - stringtriggers when the binding value changes
blurFunctionevent - FocusEventtriggers when DateTimePicker blurs
focusFunctionevent - FocusEventtriggers when DateTimePicker focuses
visible-changeFunctionvisible - booleantriggers when the DateTimePicker's dropdown appears/disappears

Created by DeepVision Software.