Components/DatePicker
Universal Component

DatePicker

Date selector built on TxPicker with a YYYY-MM-DD model.

This page was migrated by AI, please review carefully

Migration is complete, but please validate against source code and manual review.

DatePicker

TxDatePicker wraps TxPicker with year, month, and day columns and exposes a YYYY-MM-DD string model. Use it when the UI needs a compact date selector with optional popup behavior and simple min/max bounds.

Basic Usage

DatePicker

Demo will load when visible.
<script setup lang="ts">
import { ref } from 'vue'

const visible = ref(false)
const value = ref('2026-01-02')
</script>

<template>
  <div style="width: 360px; padding: 16px; border: 1px solid var(--tx-border-color); border-radius: 12px;">
    <div style="display: flex; gap: 8px; align-items: center;">
      <TxButton variant="primary" @click="visible = true">
        Open date picker
      </TxButton>
      <div style="color: var(--tx-text-color-secondary);">
        Value: {{ value }}
      </div>
    </div>

    <TxDatePicker
      v-model="value"
      v-model:visible="visible"
      title="Date"
      min="2025-01-01"
      max="2030-12-31"
    />
  </div>
</template>

API

Props

PropTypeDefaultDescription
modelValuestring''Selected date in YYYY-MM-DD format. Invalid or empty values initialize from today and are clamped by min / max when provided.
visiblebooleanfalseControls popup visibility via v-model:visible.
popupbooleantrueRenders through the picker popup surface when enabled.
titlestring'Select date'Toolbar title forwarded to TxPicker.
minstring-Earliest selectable date in YYYY-MM-DD format. Earlier year/month/day options are disabled or clamped.
maxstring-Latest selectable date in YYYY-MM-DD format. Later year/month/day options are disabled or clamped.
disabledbooleanfalseDisables picker interaction.
showToolbarbooleantrueShows or hides the picker toolbar.
confirmTextstring'Confirm'Confirm button label forwarded to TxPicker.
cancelTextstring'Cancel'Cancel button label forwarded to TxPicker.
closeOnClickMaskbooleantrueAllows the popup mask to close the picker when clicked.

Events

EventParamsDescription
update:modelValue(value: string)Emitted with a formatted YYYY-MM-DD value when the picker columns change.
change(value: string)Mirrors picker value changes with the same formatted date.
update:visible(visible: boolean)Emitted when the inner picker requests a visibility change.
confirm(value: string)Emitted with the current formatted date when the user confirms.
cancel-Emitted when the picker cancel action fires.
open-Forwarded when the picker opens.
close-Forwarded when the picker closes.