Skip to content

BbCalendar

A calendar in place — the month grid (or month / year grid, or day grid plus time rail) with no popover and no field chrome; v-model of a day, range, set, month, year or datetime.

import { BbCalendar } from 'bitboss-ui';

On this page

Props

NameDescription
activeSegment Type: BbCalendarSegment

Which end the time rail edits in range + type="datetime" (v-model:active-segment). Standalone use manages this internally; an embedding host (the date input) drives it from its focused field. Ignored outside range + datetime.

ampm Type: booleanDefaultfalse

12-hour display with an AM/PM column (requires type="datetime"); emits stay 24h.

clearable Type: booleanDefaultfalse

Clicking the selected date (week, month, year) again clears a single value. Off: re-picking keeps it. multiple and range ignore it.

Without it, clicking the picked date again keeps it, which suits a required choice.

See example
disabled Type: booleanDefaultfalse

Disables every cell, the navigation and the time rail.

See example
firstDayOfWeek Type: 0 | 1 | 2 | 3 | 4 | 5 | 6Defaultthe locale's week start

First day of the week (0 = Sunday … 6 = Saturday). Omitted, the active locale's week start: Monday for it, de, fr, en-gb…, Sunday for bare en (US) and pt (Brazil). Ignored under type="week": ISO weeks run Monday to Sunday, so a week grid always starts on Monday.

See example
floating Type: booleanDefaultfalse

Emit plain calendar strings instead of zoned ISO instants. Implied (and forced) by type="week", type="month" and type="year".

For delivery days, stays and report filters: a calendar day that must read the same in every timezone.

See example
max Type: string

Maximum selectable value, in this type's shape (as min). A finer bound is ceiled to the unit, with a warning. With datetime, on its own day the time rail disables the times after it.

See example
min Type: string

Minimum selectable value in this type's shape (YYYY-MM-DD, …THH:mm with datetime, YYYY-MM / YYYY with month / year; a week or a date with week, whole weeks only). A finer bound is floored to the unit, with a warning. With datetime the rail disables the earlier times on its day.

An empty calendar whose window lies entirely after today opens on this month instead of on a disabled grid.

See example
modelValue Type: string | string[] | null

v-model: null when empty, a string, a [start, end] pair with range, or a sorted array with multiple. The string is YYYY-MM-DD when floating (YYYY-Www / YYYY-MM / YYYY for week / month / year), otherwise a zoned ISO instant (carrying the time under datetime).

month Type: string

The month on screen (v-model:month): the ISO date of its first day ('2026-11-01'; the first of several). A write (any day, or YYYY-MM) shows that month and is not written back; paging emits the new view.

multiple Type: booleanDefaultfalse

Multi-selection: each pick toggles a value in a sorted array (days, weeks, months or years). Needs an array modelValue ([] when empty, never null). Throws with range or type="datetime".

See example
numberOfMonths Type: numberDefault1

How many months show side by side (day grids only). The keyboard crosses from one month into the next, and the arrows page all of them at once. Too narrow for them all, the months wrap onto the next row.

See example
pt Type: (PtCompoundOf<"", { readonly parts: readonly ["root", "header", "arrow", "month", "year", "cellColumnHeader", "week", "weekNumber", "day", "dayButton", "monthItem", "yearItem", "item"]; readonly states: readonly ["outside", "today", "inRange", "selected", "rangeStart", "rangeEnd", "disabled", "active", "highlighted"]; readonly wide: readonly ["disabled"]; readonly node: { readonly week: readonly ["inRange", "selected", "rangeStart", "rangeEnd"]; readonly weekNumber: readonly ["inRange", "selected", "rangeStart", "rangeEnd"]; readonly day: readonly ["outside", "today", "inRange", "selected", "rangeStart", "rangeEnd", "highlighted"]; readonly dayButton: readonly ["outside", "today", "inRange", "selected", "rangeStart", "rangeEnd", "highlighted"]; readonly monthItem: readonly ["inRange", "selected", "rangeStart", "rangeEnd", "highlighted"]; readonly yearItem: readonly ["inRange", "selected", "rangeStart", "rangeEnd", "highlighted"]; readonly month: readonly ["active"]; readonly year: readonly ["active"]; readonly item: readonly ["selected"]; }; }> & { header?: PtValue | undefined; root?: PtValue | undefined; "header:disabled"?: PtValue | undefined; "root:disabled"?: PtValue | undefined; item?: PtValue | undefined; "item:disabled"?: PtValue | undefined; arrow?: PtValue | undefined; month?: PtValue | undefined; year?: PtValue | undefined; cellColumnHeader?: PtValue | undefined; week?: PtValue | undefined; weekNumber?: PtValue | undefined; day?: PtValue | undefined; dayButton?: PtValue | undefined; monthItem?: PtValue | undefined; yearItem?: PtValue | undefined; "arrow:disabled"?: PtValue | undefined; "month:disabled"?: PtValue | undefined; "year:disabled"?: PtValue | undefined; "cellColumnHeader:disabled"?: PtValue | undefined; "week:disabled"?: PtValue | undefined; "weekNumber:disabled"?: PtValue | undefined; "day:disabled"?: PtValue | undefined; "dayButton:disabled"?: PtValue | undefined; "monthItem:disabled"?: PtValue | undefined; "yearItem:disabled"?: PtValue | undefined; "item:selected"?: PtValue | undefined; "month:active"?: PtValue | undefined; "year:active"?: PtValue | undefined; "week:inRange"?: PtValue | undefined; "week:selected"?: PtValue | undefined; "week:rangeStart"?: PtValue | undefined; "week:rangeEnd"?: PtValue | undefined; "weekNumber:inRange"?: PtValue | undefined; "weekNumber:selected"?: PtValue | undefined; "weekNumber:rangeStart"?: PtValue | undefined; "weekNumber:rangeEnd"?: PtValue | undefined; "day:outside"?: PtValue | undefined; "day:today"?: PtValue | undefined; "day:inRange"?: PtValue | undefined; "day:selected"?: PtValue | undefined; "day:rangeStart"?: PtValue | undefined; "day:rangeEnd"?: PtValue | undefined; "day:highlighted"?: PtValue | undefined; "dayButton:outside"?: PtValue | undefined; "dayButton:today"?: PtValue | undefined; "dayButton:inRange"?: PtValue | undefined; "dayButton:selected"?: PtValue | undefined; "dayButton:rangeStart"?: PtValue | undefined; "dayButton:rangeEnd"?: PtValue | undefined; "dayButton:highlighted"?: PtValue | undefined; "monthItem:inRange"?: PtValue | undefined; "monthItem:selected"?: PtValue | undefined; "monthItem:rangeStart"?: PtValue | undefined; "monthItem:rangeEnd"?: PtValue | undefined; "monthItem:highlighted"?: PtValue | undefined; "yearItem:inRange"?: PtValue | undefined; "yearItem:selected"?: PtValue | undefined; "yearItem:rangeStart"?: PtValue | undefined; "yearItem:rangeEnd"?: PtValue | undefined; "yearItem:highlighted"?: PtValue | undefined; })

Passthrough, object form: the same keys as the pt:* attributes without the prefix. See the pt:<part> row.

pt:<part> Type: PtValue

Passthrough, attribute form: one attribute per part, pt:<part>, and per part and state, pt:<part>:<state>. Parts: arrow, cellColumnHeader, day, dayButton, header, item, month, monthItem, root, week, weekNumber, year, yearItem. States: active, disabled, highlighted, inRange, outside, rangeEnd, rangeStart, selected, today.

pt:root="[--cell:36px]" resizes the whole grid. Restyle the mark on pt:day-button; a background on pt:day fills the cell square. In the page, raise --cell on phones yourself: only the picker sheet enlarges its days.

See example
range Type: booleanDefaultfalse

Enables range selection ([start, end]).

Keep the model an array, with [] as the empty state.

See example
readonly Type: booleanDefaultfalse

Shows the calendar and lets the user page through it, but no pick changes the value.

For a confirmed choice that stays on screen. Paging through months still works.

See example
seconds Type: booleanDefaultfalse

Adds the seconds column (requires type="datetime").

selectable Type: ((date: string) => boolean)

Predicate invoked per candidate; return false to disable it. Receives the value in this type's shape — YYYY-Www under week (so a week is enabled or disabled whole), YYYY-MM under month, YYYY under year.

For rules a window cannot express, such as weekends or closures. Refused days are already disabled and announced; add no click guard of your own.

See example
step Type: numberDefault1

Minute-column granularity and arrow stepping (requires type="datetime").

See example
time Type: string | string[] | null

Companion time model (v-model:time), 24-hour HH:mm / HH:mm:ss. With floating it is the only carrier of the time; otherwise it mirrors the time inside modelValue. Requires type="datetime".

today Type: string

Today's date, an ISO day like the values ('2025-12-11'; a date-time is read to its day): the day marked today and the month an empty calendar opens on. Unset: the browser's date. Also a config default (all.today).

Fix it for a demo, a screenshot test or a business date: a fixed today is marked on the server too and never moves at midnight. Set it for the whole app with components: { all: { today } }.

See example
type Type: DatePickerTypeDefault"date"

What the calendar selects and emits: date (a day), datetime (a day plus a time rail), week (an ISO week, YYYY-Www: any day picks its row), month (YYYY-MM) or year (YYYY). week / month / year force floating, ignore utc, and leave the time props inert.

See example
utc Type: booleanDefaultfalse

Emit UTC (...Z) instead of the local offset. Ignored with floating, and therefore with type="week"/type="month"/type="year".

v-model

Values kept in sync through v-model.

NameDescription
activeSegment Type: BbCalendarSegment
modelValue Type: string | string[] | null

Empty, the calendar opens on today's month (the today prop, else the browser's date after hydration), or the nearest month inside min and max. Inside a BbForm it is not submitted unless you bind it with useBbFormField.

See example
month Type: string

Bind it to load the marks for the month on screen: paging writes the first day of the new month.

See example
time Type: string | string[] | null

With floating it is the only place the time is kept, so bind it. The model is 24-hour whatever ampm displays.

See example

Events

NameDescription
active Type: (value: BbDateValue): void

Focus or a click entered the calendar, with the current value.

grid-pick Type: (value: string | string[] | null): void

Relay of the raw grid pick, before this component combines it with the time. An embedding host binds this to run its own value engine (the date picker closes on it once the selection is complete); clean consumers ignore it and use update:modelValue.

inactive Type: (value: BbDateValue): void

Focus or a click left the calendar after it was active, with the current value.

time-pick Type: (payload: { unit: TimeUnit; value: string; }): void

Relay of the raw time-rail pick. An embedding host binds this to run its own value engine; clean consumers ignore it and use update:time.

update:activeSegment Type: (value: BbCalendarSegment): void

The active range end changed (range + type="datetime" only).

update:modelValue Type: (value: string | string[] | null): void

Emitted when the selected value changes: a string (single), [start, end] (range), a sorted array (multiple). Empty is null for a single value and [] for a range or multiple, never null.

See example
update:month Type: (value: string): void

The user paged to another month: its first day, ISO (v-model:month).

update:time Type: (value: string | string[] | null): void

Companion time model, alongside every change while type="datetime".

value-commit Type: (value: BbDateValue): void

Emitted once the user finishes changing the value, after the last update:modelValue, with the same value: on each day pick or toggle (and time pick under type="datetime"); a range only once its second end is picked. Never for a value you set.

The hook for saving: once per pick, a range once both ends are set. Never for a value your code sets.

See example

Slots

The listed properties are the ones exposed to the slot scope.

NameDescription
<YYYY-MM-DD> Type: BbCalendarDaySlotProps

One date's button label (e.g. #2024-03-15: the local YYYY-MM-DD, which slotKey leaves as it is); beats day. Day grid only.

Named after the local date exactly as written: #2026-12-25. It replaces the day number on that date only.

See example
<YYYY-MM-DD>:append Type: BbCalendarDaySlotProps

Content under one date's cell; beats day:append.

Named after the local date exactly as written: #2026-12-25:append. It wins over day:append on that date.

See example
day Type: BbCalendarDaySlotProps

Replaces the day button label inside each calendar day.

Replaces every day's number, for a price or a symbol in its place. Its text is read after the full date; the scope also carries today and disabled.

See example
day:append Type: BbCalendarDaySlotProps

Appends content below each calendar day.

Look the day up from item (its local YYYY-MM-DD) and skip outside days. Its text is read as the day's description, so mark a bare dot aria-hidden. Every week takes the height of the tallest decorated week.

See example

Renamed and removed

Names from v2 and from earlier 3.0 betas that no longer work, and what to write instead.

  • slotappend:<x><x>:appendfails silently
  • slotappend:dayday:appendfails silently
  • pt:columnHeaderpt:cellColumnHeaderfails silently