Calendar

A single-date month calendar with month navigation, min/max date constraints, and full keyboard support. Displays a stable 6-week grid with dimmed days from adjacent months.

Usage

<script>
  import { Calendar } from '@vultra/ui';

  let date = $state('2026-08-07');
</script>

<Calendar bind:value={date} />

Options

<!-- Restrict the selectable range -->
<Calendar min="2026-01-01" max="2026-12-31" onDayClick={(iso) => console.log(iso)} />

Props

PropTypeDefaultDescription
valuestring \| nullnullSelected date as YYYY-MM-DD (bindable)
monthnumbercurrent monthVisible month, 0-based (bindable)
yearnumbercurrent yearVisible year (bindable)
minstringEarliest selectable date (YYYY-MM-DD)
maxstringLatest selectable date (YYYY-MM-DD)
onDayClick(date: string) => voidCalled with the YYYY-MM-DD when a day is selected
classstringAdditional classes

All other props are forwarded to the root <div> (aria-label, id, etc.).

Keyboard navigation

KeyAction
ArrowLeft / ArrowRightMove focus one day
ArrowUp / ArrowDownMove focus one week
Enter / SpaceSelect the focused day
EscapeReset focus to the selected day (or today)

Features

  • Month grid with prev/next navigation
  • Min/max date constraints (out-of-range days are disabled)
  • Full keyboard navigation with focus ring
  • Today highlighted, days outside the month dimmed
  • Stable 6-week grid so the calendar doesn’t jump in height

Install

npx @vultra/cli add calendar