Calendar
Range picker with a trigger, month grid, optional presets, and time fields. Click the trigger to open.
Default
value plus @change. allow-clear shows an × when a range is set. min-value and max-value clamp the grid.
Horizontal layout
horizontal-layout puts presets beside the grid. Hide times with show-time-input false.
Sizes
medium is the default trigger (32px). small is 28px and tightens the grid.
Presets
Record of CalendarPreset. Each entry needs text, start, and end.
Compact
Tighter padding. Presets wrap in a row above the grid.
1
<Calendar compact :presets="presets" :value="range" @change="range = $event" />
Stacked
Presets above the month. Use this in a sidebar or any narrow column.
1
<Calendar stacked :presets="presets" :value="range" @change="range = $event" />
Presets with default value
preset-index selects a preset on mount when value is empty. Index is the key order.
Min and max dates
Days outside the window are disabled. Bind the data retention range, not an arbitrary year.
Pinned timezone
pinned-timezone locks the zone and renders it as read-only text instead of a select.
Best practices
- Calendar is a range picker for analytics windows and any surface where weekday and month context matter. A single typed ISO date is an Input.
- Ship presets for the common windows (
Last 7 Days,Last Month).stackedin a sidebar;horizontal-layoutwhen results sit beside the popover. - Set
min-valueandmax-valueto the data you actually have. Do not let people pick outside retention. - Keep
valueafter the popover closes so the next open can tweak the end date.v-model:valueis the Vue alias forvalue+@change. - Default the timezone to the viewer. Use
pinned-timezoneonly when the report is locked to a region. Do not silently render UTC for a Pacific viewer. - The trigger already labels the committed range. Do not replace it with “Pick a date” after a value is set.