Skip to content

OrigamDatePickerControls ​

<OrigamDatePickerControls> is the navigation toolbar of <OrigamDatePicker>: a month button and a year button (each with a chevron that flips while its grid is open), and the previous / next arrows. It renders that row and nothing else — it holds no date state and performs no navigation of its own. Every button only emits; the parent decides what the click means.

It is rendered automatically inside <OrigamDatePicker>; you use it directly only when replacing the picker's default slot with your own layout.

Basic usage ​

vue
<template>
    <OrigamDatePickerControls
        :text="monthLabel"
        :year-text="yearLabel"
        :view-mode="viewMode"
        @click:prev="month--"
        @click:next="month++"
        @click:month="viewMode = 'months'"
        @click:year="viewMode = 'years'"
    />
</template>

<script setup lang="ts">
import { ref, computed } from 'vue'

const month = ref(new Date().getMonth())
const viewMode = ref('month')
const monthLabel = computed(() => new Date(2024, month.value).toLocaleString(undefined, { month: 'long' }))
const yearLabel = '2024'
</script>

Props ​

Content ​

PropTypeDefaultDescription
textstringundefinedLabel of the month button (opens the months grid) — the picker feeds it the formatted month name, e.g. "September"
yearTextstringundefinedLabel of the year button (opens the years grid) — the picker feeds it the formatted year, e.g. "2026"

State ​

PropTypeDefaultDescription
viewModeTDateMode'month'Grid currently open ('month' = day grid, 'months', 'years'). Sets aria-expanded on the matching button and flips its chevron

Icons ​

PropTypeDefaultDescription
prevIconTIconMDI_ICONS.CHEVRON_LEFTIcon of the "previous" arrow
nextIconTIconMDI_ICONS.CHEVRON_RIGHTIcon of the "next" arrow
modeIconTIconMDI_ICONS.MENU_DOWN_OUTLINEChevron icon shown on both the month and the year button

Disabled state ​

Each flag is OR-ed with the global disabled, so disabled alone greys the whole row.

PropTypeDefaultDescription
disabledbooleanundefinedDisables all four buttons
disabledMonthbooleanundefinedDisables the month button
disabledYearbooleanundefinedDisables the year button
disabledPrevbooleanundefinedDisables the "previous" arrow
disabledNextbooleanundefinedDisables the "next" arrow

Commons ​

PropTypeDefaultDescription
idstringautoForwarded to the root element and to the useStyle scope
classstring | string[] | objectundefinedAppended to the root class list
styleStyleValueundefinedAppended to the root inline style

Declared but inert ​

Declared so that IDatePickerProps can extend this interface; warns once in development (useUnsupportedProp) when you pass it.

PropTypeWhy it has no effect
activestring | string[] | boolean | IActiveStateThe row mirrors the picker's view state; it has no active state of its own

Emits ​

The MouseEvent is typed as optional because the handlers call emits('click:prev') and friends without forwarding it — in practice listeners always receive undefined.

EventPayloadFired by
click:monthMouseEvent | undefinedThe month button
click:yearMouseEvent | undefinedThe year button
click:prevMouseEvent | undefinedThe "previous" arrow
click:nextMouseEvent | undefinedThe "next" arrow

Slots ​

None. IDatePickerControlsSlots is deliberately empty: the template renders a fixed toolbar with no <slot> anywhere. To change the layout, replace the whole component through <OrigamDatePicker>'s default slot.

Exposed instance API ​

defineExpose publishes filterProps, css, id, load, unload and isLoaded — the standard useStyle / useProps surface. <OrigamDatePicker> uses filterProps to decide which of its own props belong to this child.

Behaviour notes ​

  • Chevron rotation. The chevron of the button whose grid is open (viewMode months / years) pivots 180° (__month-btn--open / __year-btn--open); the transition is disabled under prefers-reduced-motion: reduce.
  • Structure. Month button + year button sit in one <OrigamBtnGroup>, an <OrigamSpacer> pushes the arrows to the far end, and the arrows sit in a second group inside .origam-date-picker-controls__month.
  • Accessibility. All four controls are real <OrigamBtn> buttons, so they are focusable and operable with Enter / Space out of the box. The month and year buttons carry an explicit aria-label ("Choose the month, currently June") and aria-expanded reflecting their grid; the arrows are icon-only with their own aria-label.

Examples ​

Disabling navigation at a boundary ​

vue
<template>
    <OrigamDatePickerControls
        :text="monthLabel"
        :disabled-prev="month <= 0"
        :disabled-next="month >= 11"
        @click:prev="month--"
        @click:next="month++"
    />
</template>

Read-only header ​

vue
<template>
    <OrigamDatePickerControls :text="monthLabel" disabled />
</template>