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-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.
<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-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.
<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
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue (Vue) / value (React) | Date | null | null | Currently selected date |
defaultValue | Date | null | null | Uncontrolled initial value |
month | Date | current month | Controlled displayed month |
defaultMonth | Date | — | Uncontrolled initial displayed month |
min / max | Date | — | Selectable range endpoints (inclusive) |
weekStartsOn | 0 | 1 | 1 | 0 = Sunday, 1 = Monday |
showWeekNumbers | boolean | false | Show the ISO week-number column |
size | 'sm' | 'md' | 'lg' | 'md' | Overall font size |
disabled | boolean | false | Disable all interactions |
className | string | — | Forwarded 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