Skip to content

OrigamDatePickerField ​

<OrigamDatePickerField> is a text-field that opens an <OrigamDatePicker> in a dropdown menu. Selected dates are displayed as chips or plain text inside the field.

Basic usage ​

vue
<template>
    <OrigamDatePickerField v-model="date" label="Appointment" />
</template>

<script setup>
import { ref } from 'vue'
const date = ref(null)
</script>

Range and multiple ​

vue
<template>
    <OrigamDatePickerField v-model="dates" range label="Date range" />
    <OrigamDatePickerField v-model="dates" multiple label="Multiple dates" />
</template>
PropTypeDefaultDescription
rangebooleanfalseEnables range mode (start + end dates)
multiplebooleanfalseEnables multiple date selection

Typing a date directly ​

Besides picking a date from the popover calendar, the single-date field (no range, no multiple) also accepts a date typed directly into the text input, parsed through the DS's own date adapter (useDate() — the same one every calendar computation already goes through).

modelValue is written the instant the typed text parses to a complete, valid date — not on every keystroke and not only on blur. A partial or invalid string (09/1, not-a-date) is silently rejected: it is never written to the model, and the field keeps its last committed value until the input is either completed or cleared. Clearing the field resets the model the same way click:clear already does.

range and multiple remain popover-only for now — typing a free-text range or a multi-date list has no established format to parse against, so direct typing is intentionally not wired for those two modes.

Chips display ​

vue
<template>
    <OrigamDatePickerField v-model="dates" multiple :chip-props="{ color: 'primary' }" closable-chips />
</template>
PropTypeDescription
chipPropsIChipPropsProps forwarded to the chip elements
closableChipsbooleanMakes chips closable (removes date on close)

Validation ​

OrigamDatePickerField forwards rules, errorMessages, and validateOn to the underlying OrigamTextField / OrigamInput. The value passed to each rule function is the internal date array (Array<string>).

  • Single mode — array is empty ([]) when nothing is selected, or contains one ISO date string when a date is chosen.
  • Range / Multiple mode — array holds all selected dates; for range, it contains [startDate, endDate] once both are picked.

A required rule should check Array.length > 0 (single or multiple) or Array.length >= 2 (range):

vue
<template>
    <OrigamDatePickerField
        v-model="date"
        label="Appointment"
        :rules="[(v) => (Array.isArray(v) ? v.length > 0 : !!v) || 'Date required']"
        validate-on="blur"
    />
    <OrigamDatePickerField
        v-model="dates"
        label="Date range"
        range
        :rules="[(v) => (Array.isArray(v) ? v.length >= 2 : false) || 'Select start and end date']"
        validate-on="blur"
    />
</template>
PropTypeDefaultDescription
rulesArray<(v: unknown) => true | string>undefinedValidation rules. Receives the date array as value.
errorMessagesArray<string> | stringundefinedStatic error messages to display unconditionally.
validateOn'input' | 'blur' | 'submit' | 'lazy''input'When validation is triggered.
PropTypeDefaultDescription
menubooleanfalseControls picker visibility
menuPropsIMenuPropsundefinedProps forwarded to OrigamMenu
closeOnSelectbooleanfalseCloses after a date is selected
openOnClearbooleanfalseRe-opens when field is cleared
openTextstring'origam.open'ARIA label when picker is closed
closeTextstring'origam.close'ARIA label when picker is open

The dropdown follows your own typography ​

The calendar is teleported out of the field's DOM subtree so it can escape overflow and stacking contexts. A consequence catches most applications out: CSS you write against the field never reaches the popup. A compact form theme, a scaled container, or a plain rule like

css
.my-form .origam-date-picker-field * { font-size: 13px; }

used to shrink the control and leave the weekday header, week numbers, and day cells at their own size — a small field opening a visibly oversized calendar.

Inheriting font-size on the teleported surface would not have fixed it either: those elements are sized with rem-based tokens (var(--origam-date-picker-month__weekday---font-size, .85rem) and siblings), and rem resolves against the document root, not the parent — they would keep the root size whatever the surface inherited.

So OrigamDatePickerField measures the typography that actually won on the field when the popup opens, and republishes it on the teleported surface as the tokens the calendar already reads (plus --origam-picker-title---font-size, for a popup title). Nothing to configure: any rule of yours that changes the field's font is picked up, including rules the design system cannot see.

menuProps.contentProps.style still wins, for a popup you want to diverge on purpose:

vue
<template>
  <OrigamDatePickerField
      v-model="date"
      label="Appointment"
      :menu-props="{ contentProps: { style: { fontSize: '15px' } } }"
  />
</template>

The measurement is taken at open time, so a font that changes while the popup is already open is picked up at the next opening.

TokenDescription
--origam-date-picker-month__weekday---font-sizeRepublished by the typography bridge at open time; falls back to .85rem
--origam-date-picker-month__weeks---font-sizeRepublished by the typography bridge at open time; falls back to .85rem
--origam-date-picker-month__day---font-sizeRepublished by the typography bridge at open time; falls back to .85rem
--origam-picker-title---font-sizeRepublished by the typography bridge when the popup has a title; falls back to .75rem

Transition ​

PropTypeDefaultDescription
transitionboolean | string | TTransitionPropsundefinedOverrides the transition used for the picker's appearance. From the transversal ITransitionComponentProps mixin

Inherited surface ​

IDatePickerFieldProps extends ITextFieldProps, so the whole text-field API is available on this component and is documented once, on its owner:

  • Field chrome (IFieldProps) — label, hint, prefix, suffix, variant, size, density, rounded, elevation, inline, singleLine, centerAffix, persistentClear, required, error, disabled, dirty, clearable / clearIcon and the other adjacent-inner icons, plus the loader, colour, active/focus and typography mixins. See OrigamField.
  • Input (IInputProps) — hint, persistentHint, messages, hideDetails, the dimension / direction mixins, and the validation surface (rules, validateOn, errorMessages, readonly) documented above. See OrigamInput.
  • Text field's own — placeholder, persistentPlaceholder, counter, counterValue, persistentCounter, autofocus, role, spacing and border mixins. See OrigamTextField.

type, mask and modelModifiers are inherited by type but meaningless here: the visible control is not a free-text input — it renders the selection as text or chips and defers editing to the picker.

Slots ​

Field chrome ​

Forwarded verbatim to the nested <OrigamTextField>.

SlotBindingsDescription
prepend—Content outside the field, left side
append—Content outside the field, right side
prependInner—Content inside the field, left
appendInner—Content inside the field, right
floatingLabelILabelPropsCustom floating label
labelILabelPropsCustom label
prefix—Text prefix
suffix—Text suffix
clear—Custom clear control
loader—Custom loader

Selection display ​

These three are this component's own, and they are the reason IFieldSlots' scoped default is omitted: <OrigamDatePickerField> fills the field body itself with the selection markup rather than handing it to the consumer.

SlotBindingsDescription
selection—Overrides the text representation of a single selected date
rangeSelection—Overrides the formatted "start → end" text in range mode
chip{ item: string, index: number, props: Record<string, unknown> }Overrides one selected-date chip in multiple mode. props carries the pre-wired <OrigamChip> binding — spread it so closableChips keeps removing the right date

Emits ​

Both declared emits are useVModel relays, not literal emit(…) calls in the component body.

EventPayloadDescription
update:modelValuestring | Date | Array<...>Date selection changed
update:menubooleanPicker opened or closed

The field-level events — update:focused, click:clear, click:prepend, click:append, click:prependInner, click:appendInner — are not declared on IDatePickerFieldEmits. They still reach you: <OrigamTextField> is this component's root, so an undeclared listener falls through to it and fires from there. <OrigamDatePickerField> binds its own @click:clear handler on that same root for its bookkeeping (empty the selection, and re-open the picker when openOnClear is set); Vue merges the two, so both run — yours does not replace it.