Skip to content
LIBRARYForms

Calendar ​

Added in alpha.11

Included in Mavis 0.1.0-alpha.11 for Vue + Vite, Nuxt and NativeScript iOS/Android. Keep core and renderers on the same version.

Web preview
Open example ↗
vue
<MCalendar v-model="dates" mode="range" label="Your next escape" initialMonth="2026-11" locale="en-US" />
PropTypeDefaultDescription
modelValue / v-modelCivilDate or DateRange or nullnullISO date in single mode, start/end object in range mode.
modesingle or rangesingleSingle date or inclusive range.
min / max / unavailableDatesCivilDate / CivilDate / readonly CivilDate[]— / — / []Bounds and unavailable dates.
initialMonth / locale / firstDayOfWeekstring / en-US or pt-BR / number2000-01 / en-US / localeDeterministic empty month; no implicit clock access.
todayCivilDate or nullnullThe app's current date, marked with a small dot and aria-current="date".
disabled / readonlybooleanfalsePrevents selection; readonly permits month browsing.

Inline calendar using the same civil-date arithmetic as the date pickers. Dates are not timestamps and no timezone is applied. The first click sets start; the second completes the range and may precede start. A range spanning an unavailable date emits invalid and preserves the first endpoint. Clicking after a complete range starts a new one. Mounting never steals focus. Web provides one Tab stop, arrows, Home/End and PageUp/PageDown; native uses buttons and horizontal scrolling for large text. Use footer for a legend or actions.

Motion ​

The calendar moves with Jolt. Changing month slides the grid in from the side you are heading to, mirrored in right-to-left layouts, while the month title rolls up or down. The chosen day pops, and completing a range fills the band from the date you picked first toward the new one. Once a start is set, hovering or moving focus across days previews the band on the Web. A refused range shakes the calendar once.

Mavis never reads the device clock, so pass today yourself when you want it marked. Values, focus and announcements change immediately; motion is decoration and follows the reduced motion preference.

vue
<script setup lang="ts">
import { computed, ref } from 'vue'
import { useCatalogLocale } from '../locale'
const props = defineProps<{ lang?: 'en' | 'pt' }>()
const { locale } = useCatalogLocale(() => props.lang)
const pt = computed(() => (props.lang ?? locale.value) === 'pt')
const t = (en: string, br: string) => (pt.value ? br : en)
import type { CivilDate, DateRange } from '@getcortexlabs/mavis-core'
const dates = ref<CivilDate | DateRange | null>({ start: '2026-11-10', end: '2026-11-13' })
const selected = computed(() =>
  typeof dates.value === 'object' && dates.value
    ? `${dates.value.start ?? '…'} / ${dates.value.end ?? '…'}`
    : '',
)
</script>

<template>
  <MColumn gap="md">
    <MText
      variant="overline"
      :text="t('MAKE TIME FOR SOMETHING GOOD', 'RESERVE TEMPO PARA ALGO BOM')"
      tone="primary"
    />
    <MCalendar
      v-model="dates"
      mode="range"
      :label="t('Your next escape', 'Sua próxima escapada')"
      initialMonth="2026-11"
      today="2026-11-06"
      min="2026-11-01"
      max="2027-02-28"
      :unavailableDates="['2026-11-18']"
      :locale="pt ? 'pt-BR' : 'en-US'"
    >
      <template #footer
        ><MText
          :text="
            t(
              'Choose a start and end date. November 18 is unavailable.',
              'Escolha início e fim. O dia 18 de novembro está indisponível.',
            )
          "
          variant="caption"
          tone="muted"
      /></template>
    </MCalendar>
    <MText id="calendar-value" :text="selected" variant="caption" />
  </MColumn>
</template>

Desktop ​

On the Mac and on Windows the month is a grid of native buttons with one tab stop: arrows move the day, Home and End reach the ends of the week, Page Up and Page Down change the month (with Shift, the year) and Enter or Space chooses the day. Ranges, unavailable days, today, the locale and the first day of the week work as on the Web, and the pointer previews a range. See Desktop components.

Components for NativeScript and Web. Starting with Vue.