Preview Updated 2026-05-10

Calendar

Embedded month-view calendar with week numbers, configurable week start, min/max range, and three sizes.

Basic usage

CfCalendar is a standalone month-view calendar — unlike DatePicker, it sits inline on the page rather than floating in a popover. The selected date is exposed via v-model (Vue) or value + onChange (React). Click to switch months; click a date to select it.

2026 年 5 月
已选:2026-05-10
<CfCalendar v-model="date" />
<CfCalendar value={date} onChange={setDate} />

Week start + week numbers

weekStartsOn controls which day each row starts on: 1 for Monday (default), 0 for Sunday. showWeekNumbers adds a leftmost column of ISO week numbers — common in scheduling and project-management dashboards.

周一开始 + 周序号
2026 年 5 月
#181920212223
周日开始
2026 年 5 月
<CfCalendar v-model="a" :week-starts-on="1" show-week-numbers />
<CfCalendar v-model="b" :week-starts-on="0" />
<CfCalendar value={a} onChange={setA} weekStartsOn={1} showWeekNumbers />
<CfCalendar value={b} onChange={setB} weekStartsOn={0} />

Restrict selectable range

min / max define the selectable range. Dates outside it are dimmed and don’t respond to clicks. The example below locks selection between the start of this month and the end of next month.

2026 年 5 月
允许范围:2026-05-01 ~ 2026-06-30
<CfCalendar v-model="date" :min="min" :max="max" />
<CfCalendar value={date} onChange={setDate} min={min} max={max} />

Three sizes

The overall font size is controlled by size: sm / md (default) / lg. Cell heights scale with the font size.

size = sm
2026 年 5 月
size = md
2026 年 5 月
size = lg
2026 年 5 月
<CfCalendar v-model="a" size="sm" />
<CfCalendar v-model="b" size="md" />
<CfCalendar v-model="c" size="lg" />
<CfCalendar value={a} onChange={setA} size="sm" />
<CfCalendar value={b} onChange={setB} size="md" />
<CfCalendar value={c} onChange={setC} size="lg" />

API

PropTypeDefaultDescription
modelValue (Vue) / value (React)Date | nullnullCurrently selected date
defaultValueDate | nullnullUncontrolled initial value
monthDatecurrent monthControlled displayed month
defaultMonthDateUncontrolled initial displayed month
min / maxDateSelectable range endpoints (inclusive)
weekStartsOn0 | 110 = Sunday, 1 = Monday
showWeekNumbersbooleanfalseShow the ISO week-number column
size'sm' | 'md' | 'lg''md'Overall font size
disabledbooleanfalseDisable all interactions
classNamestringForwarded to the root container

Events: onChange(date) / update:modelValue fires on date selection; onMonthChange(month) / update:month fires when the displayed month changes.

反馈与讨论

Calendar · Discussion

0
0 / 600
一键发送
正在加载评论...