Skip to content

Calendar ​

A date field component that allows users to enter and edit date. Cells grow with the space they get; swipe the grid or use PageUp / PageDown to change months, arrow keys to move between days.

Usage ​

Approximate web preview — the HarmonyOS rendering is the reference.

Multiple ​

mode: 'multiple' — tap days to toggle them.

Approximate web preview — the HarmonyOS rendering is the reference.

Range ​

SRangeCalendar shows two months side by side when it is wide enough, otherwise one.

Approximate web preview — the HarmonyOS rendering is the reference.

Locale & constraints ​

locale, weekStartsOn, minDate / maxDate, disabledDates (weekends here) and showOutsideDays.

Approximate web preview — the HarmonyOS rendering is the reference.

API ​

Extracted from the @Param / @Event / @BuilderParam declarations in the library sources.

SCalendar ​

shadcn-vue Calendar (v4 look, react-day-picker semantics).

  • One value prop per mode keeps the types simple: selected (single), selectedDates (multiple), range (range). Each has $name for !! and an on…Change event. Leave them unset to let the calendar keep its own selection.
  • month / defaultMonth: the (first) displayed month; onMonthChange reports paging.
  • Self-measuring (D11): the cell size follows the width the calendar gets (32–44vp); with numberOfMonths > 1 months sit side by side when they fit and stack otherwise. cellSize pins the cell size.
  • Paging: header chevrons, horizontal swipe on the grid, PageUp / PageDown (Shift: year). Arrow keys move the focused day (Home / End: week start / end), Enter / Space pick it.
  • Motion key calendar: month changes slide + fade the grid (one container); the selected day always switches instantly.
  • weekStartsOn: 1 = Monday (default), 0 = Sunday. locale: 'en' | 'zh' labels.
PropTypeDefaultDescription
modeSparkCalendarMode
SparkCalendarMode = 'single' | 'multiple' | 'range'
'single'
selected!!SparkDate | undefinedundefinedsingle mode
selectedDates!!SparkDate[][]multiple mode
range!!SparkDateRangenew SparkDateRange()range mode
month!!SparkDate | undefinedundefinedDisplayed (first) month — any day in it. Controlled when set.
defaultMonthSparkDate | undefinedundefinedInitially displayed month (default: the selection, else today).
minDateSparkDate | undefinedundefined
maxDateSparkDate | undefinedundefined
disabledDatesSparkDateMatcher | undefinedundefinedExtra disabled days, e.g. weekends.
requiredbooleanfalsesingle / multiple: tapping the selected day again keeps it (no deselect).
weekStartsOnSparkWeekStart
SparkWeekStart = 0 | 1
1
localeSparkDateLocale
SparkDateLocale = 'en' | 'zh'
'en'
showOutsideDaysbooleantrue
numberOfMonthsnumber1
cellSizenumber | undefinedundefinedFixed cell size in vp; undefined = adapt to the available width (32–44).
borderedbooleanfalseCard look: rounded-lg border shadow-sm (off inside popovers).
EventTypeDefaultDescription
onSelectedChange(d: SparkDate | undefined) => void() => { }
onSelectedDatesChange(d: SparkDate[]) => void() => { }
onRangeChange(r: SparkDateRange) => void() => { }
onMonthChange(m: SparkDate) => void() => { }

SRangeCalendar ​

shadcn-vue RangeCalendar: {@link SCalendar} in range mode that shows two months side by side when its own width allows (≥ 2 × 7 × 36vp + gap + padding), otherwise one.

numberOfMonths pins the month count (undefined = automatic).

PropTypeDefaultDescription
range!!SparkDateRangenew SparkDateRange()
month!!SparkDate | undefinedundefined
defaultMonthSparkDate | undefinedundefined
minDateSparkDate | undefinedundefined
maxDateSparkDate | undefinedundefined
disabledDatesSparkDateMatcher | undefinedundefined
weekStartsOnSparkWeekStart
SparkWeekStart = 0 | 1
1
localeSparkDateLocale
SparkDateLocale = 'en' | 'zh'
'en'
showOutsideDaysbooleantrue
numberOfMonthsnumber | undefinedundefinedundefined = 2 when they fit, else 1
cellSizenumber | undefinedundefined
borderedbooleanfalse
EventTypeDefaultDescription
onRangeChange(r: SparkDateRange) => void() => { }
onMonthChange(m: SparkDate) => void() => { }

MIT Licensed