Calendar
Schedules and events in a complete and compact calendar.
When to use
Calendar displays schedules, events, or metrics by calendar day. In month mode you can see the days of the month, in year mode you can see the months of the year. To select a date in a compact field, use DatePicker.
fullscreen=false embeds a mini-calendar into the card. Events and bars of several days are drawn from the application data; they do not change a single Calendar value to a range.
At viewport widths up to 480 px, the year and month selectors share a row in month view. The mode switch sits below them.
Date and panel mode
Regular Calendar works with Dayjs. With value, the application accepts the new date via onChange; without value, defaultValue or the current date is used. The managed mode is updated separately from the value.
| Problem | Setting | Example |
|---|---|---|
| Show full calendar | defaultValue |
Basic calendar |
| Associate the selected date with the state | value, onChange, onSelect |
Guided Choice |
| Embed mini calendar | fullscreen={false} |
Calendar in a card |
| Show week numbers | showWeek |
Week numbers |
| Limit available dates | validRange, disabledDate |
Valid working dates |
onChange reports a date change, onPanelChange reports the date or panel mode, onSelect reports a selection with the source date/month/year/customize. Selecting the same date again still calls onSelect. To react specifically to the day cell, check info.source=date rather than any header change.
value does not support bind:value. Save Dayjs via callback; the component does not normalize its time, milliseconds, or time zone. Another date type is connected through the public generateCalendar and CalendarGenerateConfig, rather than by passing an arbitrary Date to a standard Calendar.
Events and own header
cellRender - Svelte snippet with date and info.type=date/month. It complements the standard content. Events on the calendar show Badge for the day and total for the month; events for several days construct stripes based on the example data.
fullCellRender replaces the entire internal contents of the cell. info.originNode contains a snippet of the original internal markup that you can save in your composition. For the week number column, render-snippets are not called. Does
headerRender gets value, type, onChange and onTypeChange. For your own header, call these handlers to save the selection and mode switching. onChange of the header reports source=customize; onTypeChange changes the panel mode without a separate date picker. Example of a header uses public Svelte components for switches.
Restrictions, language and design
validRange compares boundaries inclusive of timestamp precision. For entire calendar days, specify startOf('day') and endOf('day') as in the constraint example. disabledDate identifies unavailable cells; don't modify the passed date object inside the predicate.
ConfigProvider with ruRU/enUS specifies a dictionary, locale.lang specifies a separate calendar. For another language, also load the Day.js locale and match it with the component's date and settings. Locale settings determine the start of the week; global dayjs.locale is not enough to translate all controls.
Lunar calendar receives signature via Intl. This is an adaptation of the display without the solar seasons and holiday guide. The presence of the necessary hieroglyphs depends on the page font; the selected date type remains Dayjs.
classNames/styles accept an object or function from props; styles contains CSS strings. With fullCellRender and headerRender the content belongs to your snippet. Semantic styles shows valid slots and ConfigProvider.calendar. The theme.components.Calendar component design tokens apply to the calendar, its header, and its cells.
Calendar CSS prefixes show the global ConfigProvider.prefixCls and the local prefixCls. The local value is the full base Picker prefix: the calendar root adds -calendar, and the cells and originNode use it directly. cellRender/fullCellRender get this name in info.prefixCls. An empty string/undefined returns the common provider prefix with -picker. Select and Radio headers inherit the common namespace regardless of the local Calendar.prefixCls; theme.cssVar.prefix sets theme variables separately. Changing the prefix preserves the root, date with original time, focus, and open header list.
Cells retain the keyboard navigation of the standard panel. bind:nativeElement returns the root div after mount and is cleared when unmounted; Calendar does not have exported focus/blur.
Examples
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 01 | 02 | 03 |
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
01 | 02 | 03 | 04 | 05 | 06 | 07 |
Basic calendar
Complete calendar with transition between year and month. defaultValue specifies the starting day.
<script lang="ts">
import dayjs from 'dayjs';
import { Calendar } from '@woodger/antd';
</script>
<Calendar defaultValue={dayjs('2026-10-15')} />
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 01 | 02 | 03 |
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 | 13 | 14 | 15
| 16 | 17 |
18 | 19 | 20
| 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
01 | 02 | 03 | 04 | 05 | 06 | 07 |
Calendar events
cellRender supplements days with a list of events, and months with their number. Svelte snippet is used for cell contents.
<script lang="ts">
import dayjs from 'dayjs';
import { Badge, Calendar } from '@woodger/antd';
const events = [
{ date: '2026-10-15', status: 'success', text: "Release" },
{ date: '2026-10-20', status: 'warning', text: "Check" },
{ date: '2026-10-20', status: 'processing', text: "Assembly" }
] as const;
</script>
<style>
.events {
margin: 0;
padding: 0;
list-style: none;
text-align: start;
}
li {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
<Calendar defaultValue={dayjs('2026-10-15')}>
{#snippet cellRender(date, info)}
{#if info.type === 'date'}
<ul class="events">
{#each events.filter(event => event.date === date.format('YYYY-MM-DD')) as event (event.text)}
<li title={(event.text)}><Badge status={event.status} text={(event.text)} /></li>
{/each}
</ul>
{:else}
{@const count = events.filter(event => event.date.startsWith(date.format('YYYY-MM'))).length}
{#if count}<span>{(count)}{(" events")}</span>{/if}
{/if}
{/snippet}
</Calendar>
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 01 | 02 | 03 |
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 Checking layouts | 13 | 14 Development | 15 | 16 | 17 |
18 | 19 | 20 Release | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
01 | 02 | 03 | 04 | 05 | 06 | 07 |
Events for several days
cellRender draws start, middle, end and one-day event bars. Ranges refer to example data; the Calendar value remains a single date.
<script lang="ts">
import dayjs from 'dayjs';
import { Calendar } from '@woodger/antd';
const events = [
{ title: "Checking layouts", start: '2026-10-12', end: '2026-10-15', color: '#722ed1' },
{ title: "Development", start: '2026-10-14', end: '2026-10-18', color: '#237804' },
{ title: "Release", start: '2026-10-20', end: '2026-10-20', color: '#ad4e00' }
];
</script>
<style>
.bands {
display: grid;
gap: 3px;
text-align: start;
}
.band {
height: 18px;
margin-inline: calc(-1 * var(--ant-padding-xs) - var(--ant-margin-xs) / 2);
padding-inline: 4px;
overflow: hidden;
color: white;
font-size: 11px;
line-height: 18px;
white-space: nowrap;
}
.start {
margin-inline-start: 0;
border-radius: 9px 0 0 9px;
}
.end {
margin-inline-end: 0;
border-radius: 0 9px 9px 0;
}
.single {
margin-inline: 0;
border-radius: 9px;
}
.legend {
display: grid;
gap: 8px;
margin-top: 16px;
font-size: 12px;
line-height: 1.6;
}
</style>
<Calendar defaultValue={dayjs('2026-10-15')} styles={{ itemContent: 'overflow:visible' }}>
{#snippet cellRender(date, info)}
{#if info.type === 'date'}
{@const key = date.format('YYYY-MM-DD')}
<div class="bands">
{#each events as event (event.title)}
{@const active = key >= event.start && key <= event.end}
{@const position = key === event.start
? key === event.end ? 'single' : 'start'
: key === event.end
? 'end'
: 'middle'}
<div class={['band', position]} title={(active ? event.title : undefined)}
style:background={(active ? event.color : 'transparent')}>
{#if active && (position === 'start' || position === 'single')}{(event.title)}{/if}
</div>
{/each}
</div>
{/if}
{/snippet}
</Calendar>
<div class="legend" aria-label={("Events by day")}>
{#each events as event (event.title)}
<span>{(event.title)}: {(event.start)} — {(event.end)}</span>
{/each}
</div>
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 01 | 02 | 03 |
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
01 | 02 | 03 | 04 | 05 | 06 | 07 |
Calendar in card
fullscreen=false includes a mini-calendar. The container is limited to a width of 320 px and shrinks along with the page.
<script lang="ts">
import dayjs from 'dayjs';
import { Calendar } from '@woodger/antd';
</script>
<style>.card {
max-width: 320px;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}</style>
<div class="card"><Calendar fullscreen={false} defaultValue={dayjs('2026-10-15')} /></div>
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 01 | 02 | 03 |
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
01 | 02 | 03 | 04 | 05 | 06 | 07 |
Guided selection
value is updated via onChange, onSelect reports the source and reselect. The selected day is displayed next to it.
<script lang="ts">
import dayjs from 'dayjs';
import { Alert, Calendar } from '@woodger/antd';
const initial = dayjs('2026-10-15');
let value = $state(initial);
let selected = $state(initial);
let source = $state('—');
</script>
<style>
.example {
display: grid;
gap: 16px;
}
output {
overflow-wrap: anywhere;
}
</style>
<div class="example">
<Alert type="info" role="status" title={("Selected day: " + String((selected.format('YYYY-MM-DD'))) + "")} />
<Calendar {value} onChange={date => { value = date; }}
onSelect={(date, info) => { selected = date; source = info.source; }} />
<output
aria-label={("Select Calendar")}
>{(selected.format('YYYY-MM-DD'))}{("; source: ")}{source}</output>
</div>
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 八月17日 | 28 八月18日 | 29 八月19日 | 30 八月20日 | 1 八月21日 | 2 八月22日 | 3 八月23日 |
4 八月24日 | 5 八月25日 | 6 八月26日 | 7 八月27日 | 8 八月28日 | 9 八月29日 | 10 九月1日 |
11 九月2日 | 12 九月3日 | 13 九月4日 | 14 九月5日 | 15 九月6日 | 16 九月7日 | 17 九月8日 |
18 九月9日 | 19 九月10日 | 20 九月11日 | 21 九月12日 | 22 九月13日 | 23 九月14日 | 24 九月15日 |
25 九月16日 | 26 九月17日 | 27 九月18日 | 28 九月19日 | 29 九月20日 | 30 九月21日 | 31 九月22日 |
1 九月23日 | 2 九月24日 | 3 九月25日 | 4 九月26日 | 5 九月27日 | 6 九月28日 | 7 九月29日 |
Lunar date via Intl
fullCellRender shows Chinese lunar date via built-in Intl. The solar seasons from the original example are not calculated here.
<script lang="ts">
import dayjs from 'dayjs';
import { Calendar } from '@woodger/antd';
const lunar = new Intl.DateTimeFormat('zh-CN-u-ca-chinese', { month: 'long', day: 'numeric' });
</script>
<style>
.cell {
padding: 8px 2px;
text-align: center;
}
small {
display: block;
margin-top: 4px;
color: var(--ant-color-text-secondary);
font-size: 12px;
overflow-wrap: anywhere;
}
</style>
<Calendar defaultValue={dayjs('2026-10-15')}>
{#snippet fullCellRender(date, info)}
<div class="cell">
{@render info.originNode()}
{#if info.type === 'date'}<small>{(lunar.format(date.toDate()))}</small>{/if}
</div>
{/snippet}
</Calendar>
| Week | Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|---|
40 | 27 | 28 | 29 | 30 | 01 | 02 | 03 |
41 | 04 | 05 | 06 | 07 | 08 | 09 | 10 |
42 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
43 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
44 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
45 | 01 | 02 | 03 | 04 | 05 | 06 | 07 |
Week numbers
showWeek adds week numbers. Selecting a number publishes the beginning of the calendar line.
<script lang="ts">
import dayjs from 'dayjs';
import { Calendar } from '@woodger/antd';
let value = $state(dayjs('2026-10-15'));
</script>
<style>
.example {
display: grid;
gap: 16px;
}
</style>
<div class="example">
<Calendar {value} showWeek onChange={date => { value = date; }} />
<output aria-label={("Date with week number")}>{(value.format('YYYY-MM-DD'))}</output>
</div>
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 01 | 02 | 03 |
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
01 | 02 | 03 | 04 | 05 | 06 | 07 |
Own hat
headerRender gets value, mode and callbacks. Public Select/RadioGroup controls year, month and mode.
<script lang="ts">
import dayjs from 'dayjs';
import { Calendar, RadioGroup, Select, type CalendarMode } from '@woodger/antd';
let value = $state(dayjs('2026-10-15'));
let mode = $state<CalendarMode>('month');
let source = $state('—');
</script>
<style>
.header {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
padding: 12px 0;
}
output {
display: block;
margin-top: 16px;
overflow-wrap: anywhere;
}
</style>
<Calendar {value} {mode} fullscreen={false} onChange={date => { value = date; }}
onPanelChange={(_date, next) => { mode = next; }} onSelect={(
_date,
info
) => { source = info.source; }}>
{#snippet headerRender(header)}
<div class="header">
<RadioGroup aria-label={("Custom calendar mode")} value={header.type}
options={([{ value: 'month', label: "Month" }, {
value: 'year',
label: "Year"
}])}
onValueChange={next => header.onTypeChange(next as CalendarMode)} />
<Select
aria-label={("Year of your calendar")}
value={header.value.year()}
style="width:100px"
options={([2025, 2026, 2027].map(year => ({
value: year,
label: String(year)
})))}
onValueChange={year => {
if (typeof year === 'number') {
header.onChange(header.value.year(year));
}
}}
/>
{#if header.type === 'month'}
<Select
aria-label={("Month of your calendar")}
value={header.value.month()}
style="width:120px"
options={(Array.from({ length: 12 }, (_, month) => ({
value: month,
label: `${month + 1} month`
})))}
onValueChange={month => {
if (typeof month === 'number') {
header.onChange(header.value.month(month));
}
}}
/>
{/if}
</div>
{/snippet}
</Calendar>
<output
aria-label={("Your own Calendar hat")}
>{(value.format('YYYY-MM-DD'))}{("; mode: ")}{mode}{("; source: ")}{source}</output>
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 01 | 02 | 03 |
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
01 | 02 | 03 | 04 | 05 | 06 | 07 |
Semantic styles
The classes object and styles function are applied to real slots; the function receives props Calendar.
<script lang="ts">
import dayjs from 'dayjs';
import { Calendar } from '@woodger/antd';
</script>
<Calendar fullscreen={false} defaultValue={dayjs('2026-10-15')}
classNames={{ root: 'calendar-semantic-root' }}
styles={({ props }) => ({
root: `
border: 2px dashed ${props.fullscreen ? '#722ed1' : '#52c41a'};
border-radius: 8px;
`,
header: 'padding-inline:12px',
itemContent: 'font-weight:600'
})} />
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 01 | 02 | 03 |
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
01 | 02 | 03 | 04 | 05 | 06 | 07 |
Valid working dates
validRange limits exact timestamps to inclusive; the borders are extended for whole days. disabledDate excludes weekends.
<script lang="ts">
import dayjs from 'dayjs';
import { Calendar } from '@woodger/antd';
let value = $state(dayjs('2026-10-15'));
</script>
<style>
.example {
display: grid;
gap: 16px;
}
</style>
<div class="example">
<Calendar {value} fullscreen={false}
validRange={[dayjs('2026-10-10').startOf('day'), dayjs('2026-10-20').endOf('day')]}
disabledDate={date => date.day() === 0 || date.day() === 6}
onChange={date => { value = date; }} />
<output aria-label={("Limited Date Calendar")}>{(value.format('YYYY-MM-DD'))}</output>
</div>
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 01 | 02 | 03 |
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
01 | 02 | 03 | 04 | 05 | 06 | 07 |
Interactive calendar from review
Saved example: switching the full view, week numbers and controlled date.
<script lang="ts">
import dayjs from 'dayjs';
import { Calendar } from '@woodger/antd';
let value = $state(dayjs('2026-10-29'));
let fullscreen = $state(false);
let showWeek = $state(false);
</script>
<style>
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
.controls label {
display: flex;
align-items: center;
gap: 8px;
}
.calendar {
box-sizing: border-box;
width: 360px;
max-width: 100%;
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
overflow: hidden;
}
.calendar.full { width: 780px; }
output {
display: block;
margin-top: 16px;
}
</style>
<div class="controls">
<label><input
type="checkbox"
bind:checked={fullscreen}
/>{(" Complete calendar")}</label>
<label><input type="checkbox" bind:checked={showWeek} />{(" Week numbers")}</label>
</div>
<div class="calendar" class:full={fullscreen}>
<Calendar
{value}
{fullscreen}
{showWeek}
onChange={next => { value = next; }}
/>
</div>
<output
aria-label={("Date in calendar")}
>{(value.format('DD.MM.YYYY'))}</output>
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 01 | 02 | 03 |
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
01 | 02 | 03 | 04 | 05 | 06 | 07 |
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
PrefixCls specifies the base name of Picker; Calendar appends -calendar to the root. CellRender and fullCellRender receive the same prefix via info.prefixCls, originNode uses it for its classes. Select and Radio headers separately inherit the common namespace. Both calendars use the same local class in different theme areas; the date is stored as Dayjs with the original time.
Calendar CSS prefixes
General and local Picker prefix, independent Select/Radio headers, renderers and adjacent calendar. The date with milliseconds is saved when changing names.
<script lang="ts">
import dayjs, { type Dayjs } from 'dayjs';
import {
Calendar, Checkbox, ConfigProvider, type CalendarCellRenderInfo, type CalendarMode
} from '@woodger/antd';
let custom = $state(true);
let local = $state(true);
let rtl = $state(false);
let fullscreen = $state(false);
let showWeek = $state(false);
let withVariables = $state(true);
let value = $state.raw(dayjs('2026-10-15T12:34:56.789'));
let mode = $state<CalendarMode>('month');
let changes = $state(0);
let nativeElement = $state<HTMLDivElement>();
const prefix = $derived(custom ? 'suite' : 'ant');
const localPrefix = $derived(local ? 'project-picker' : '');
</script>
<style>
.example,
section {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 16px;
min-width: 0;
}
.controls {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
p { margin: 0; }
output { overflow-wrap: anywhere; }
</style>
{#snippet marker(date: Dayjs, info: CalendarCellRenderInfo)}
<span data-render-prefix={info.prefixCls} aria-hidden="true">
{(info.type === 'date' && date.date() === 15 ? '•' : '')}
</span>
{/snippet}
{#snippet original(_date: Dayjs, info: CalendarCellRenderInfo)}
<div data-render-prefix={info.prefixCls}>{@render info.originNode()}</div>
{/snippet}
<div class="example">
<div class="controls">
<Checkbox bind:checked={custom}>{("General prefix Calendar suite")}</Checkbox>
<Checkbox bind:checked={local}>{("Local prefix Calendar")}</Checkbox>
<Checkbox bind:checked={rtl}>{("RTL Calendar with prefix")}</Checkbox>
<Checkbox bind:checked={fullscreen}>{("Full Calendar with prefix")}</Checkbox>
<Checkbox
bind:checked={showWeek}
>{("Calendar week numbers with prefix")}</Checkbox>
<Checkbox bind:checked={withVariables}>CSS variables Calendar</Checkbox>
</div>
<ConfigProvider prefixCls={prefix} direction={rtl ? 'rtl' : 'ltr'}
theme={withVariables ? { cssVar: { prefix: 'calendar-theme' } } : undefined}>
<section aria-label={("Main Calendar with prefix")}>
<Calendar prefixCls={localPrefix} bind:nativeElement class="prefix-calendar-main"
{value} {mode} {fullscreen} {showWeek} cellRender={marker}
onChange={next => {
value = next;
changes++;
}}
onPanelChange={(_date, next) => { mode = next; }} />
<output aria-label={("Calendar date with prefix")}>{(value.format('YYYY-MM-DD HH:mm:ss.SSS'))}</output>
<output aria-label={("Calendar changes with prefix")}>{("Changes: ")}{changes}</output>
</section>
<ConfigProvider prefixCls="neighbor" theme={{ cssVar: { prefix: 'neighbor-calendar-theme' } }}>
<section aria-label={("Neighboring Calendar with prefix")}>
<Calendar prefixCls={localPrefix} class="prefix-calendar-neighbor"
defaultValue={dayjs('2026-10-15T12:34:56.789')} fullscreen={false}
fullCellRender={original} />
</section>
</ConfigProvider>
</ConfigProvider>
<output aria-label={("CSS prefix Calendar")}>
Picker: {(localPrefix || prefix + '-picker')}{("; root: ")}{(localPrefix
|| prefix + '-picker')}-calendar
</output>
<output aria-label={("Calendar root with prefix")}>{(nativeElement ? "Connected" : "Waiting mount")}</output>
<p>
{("PrefixCls specifies the base name of Picker; Calendar appends -calendar to the root. CellRender and fullCellRender receive the same prefix via info.prefixCls, originNode uses it for its classes. Select and Radio headers separately inherit the common namespace. Both calendars use the same local class in different theme areas; the date is stored as Dayjs with the original time.")}
</p>
</div>
Coverage Examples
Nine themes of ant.design 6.7 live page collated. Cards are arranged in one column: events and range bars require space in width.
| Theme | Condition | Example Svelte |
|---|---|---|
| Basic | Implemented | Basic calendar |
| Notice Calendar | Implemented via cellRender | Calendar events |
| Event Range | Implemented via cellRender | Events for several days |
| Card | Implemented | Calendar in card |
| Selectable Calendar | Implemented | Guided selection |
| Lunar Calendar | Partial: lunar date via Intl, without solar seasons | Lunar date via Intl |
| Show Week | Implemented | Week numbers |
| Customize Header | Implemented via Svelte snippet | Own hat |
| Custom semantic dom styling | Implemented | Semantic styles |
Lunar example adapted via Intl: Chinese lunar date is shown, without solar seasons and holiday guide. This is display data; the model remains Dayjs.
API
The main parameters are checked against the public CalendarProps. Regular Calendar works with Dayjs. For its date type, generateCalendar is exported with the CalendarGenerateConfig adapter.
| Property | Description | Type | Default |
|---|---|---|---|
prefixCls | Full base Picker prefix; the root Calendar adds -calendar. The empty string/undefined inherit ConfigProvider. Cells, originNode and info.prefixCls follow this name; Select/Radio headers use an independent common prefix. The namespace of the topic is set separately. | string | ConfigProvider.prefixCls + "-picker" |
value | Controlled date via onChange. Without bind:value; time and timezone are not normalized. | Dayjs | undefined |
defaultValue | Start date of the local state. | Dayjs | Current date |
mode | Controlled mode. Update it in onPanelChange to enable switching. | month | year | month |
fullscreen | false includes a mini-calendar and small header controls. | boolean | true |
showWeek | Week column in month mode. Selecting a number publishes the beginning of the line. | boolean | false |
validRange | Inclusive boundaries with timestamp precision; They also limit the cap. For full days use startOf/endOf. | [Dayjs, Dayjs] | undefined |
disabledDate | Limits panel cells. A month is disabled if its first and last days are disabled. | (date: Dayjs) => boolean | undefined |
onChange | Change calendar day; reselecting the same day does not call onChange. | (date: Dayjs) => void | — |
onPanelChange | Panel transition or mode change. In controlled mode, adopt new mode outside. | (date, mode: CalendarMode) => void | — |
onSelect | Every choice, including repeated ones. source=date/month/year/customize reports the source. | (date, info: CalendarSelectInfo) => void | — |
locale | Lang is combined with a common locale and base vocabulary. | CalendarLocale | From ConfigProvider |
headerRender | Gets value, type, onChange and onTypeChange. The onChange call has source=customize. | Snippet<[CalendarHeaderRenderInfo]> | Standard hat |
cellRender | Adds content to a standard cell. info.type=date/month, prefixCls — allowed Picker prefix; originNode - internal markup snippet with this prefix. | Snippet<[Dayjs, CalendarCellRenderInfo]> | Empty addition |
fullCellRender | Replaces the contents of a cell. Not called for week numbers. | Snippet<[Dayjs, CalendarCellRenderInfo]> | Standard cell |
classNames | Classes root/header/body/content/item/itemContent, object or function with props. | CalendarSemantic | undefined |
styles | CSS lines of the same slots. Local styles come after the provider configuration. | CalendarSemantic | undefined |
nativeElement | bind:nativeElement gives root after mount and clears ref when unmount. | HTMLDivElement | undefined |
cellRender completes the contents of the cell, and fullCellRender replaces it. Both parameters accept Svelte snippets.
Events and ref
onChange reports the day change. onSelect is also called when selecting again; info.source distinguishes between date, month, year and customize. onPanelChange reports a change of panel or mode.
In managed mode, store the new value in onChange and the new mode in onPanelChange. headerRender.onChange selects date with source=customize; onTypeChange switches the mode via onPanelChange.
Calendar does not have exported focus()/blur(). bind:nativeElement gives root div after mount and clears ref when unmount; This is the Svelte equivalent of CalendarRef.nativeElement.
Semantic DOM
The table has the role grid, days and months - gridcell. The selected date is marked aria-selected, the disabled date is aria-disabled, the current date is aria-current=date. Arrows move focus, Home/End move to line boundaries, Enter/Space select a cell.
The highlight below refers to real slots. In RTL, horizontal arrows take into account the direction of the interface.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 01 | 02 | 03 |
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
01 | 02 | 03 | 04 | 05 | 06 | 07 |
| Slot | Purpose |
|---|---|
root | Root div Calendar. |
header | Standard hat with choice of year, month and mode. |
body | Table container. |
content | Table with the grid role. |
item | Day or month cell; Week numbers are excluded. |
itemContent | Additional contents of a standard cell; with fullCellRender this wrapper is replaced. |
styles accepts CSS strings, classNames — classes; both forms support callback with props. With custom headerRender, the header is created by your snippet, with fullCellRender you control the internal contents of the cell.
Registration tokens
The six component tokens correspond to the official table and the public ComponentTokenMap.Calendar. theme.components.Calendar applies tokens to the calendar. Semantic styles and ConfigProvider.calendar clarify the design.
| Token | Purpose |
|---|---|
fullBg | Full calendar background. |
fullPanelBg | Panel background. |
itemActiveBg | Selected day. |
miniContentHeight | Mini calendar height. |
monthControlWidth | Month selection width. |
yearControlWidth | Year selection width. |
Common tokens of the current topic
Names are checked against the ant.design table; the values are read reactively via theme.useToken().
| Token | Meaning |
|---|---|
colorBgContainer | #ffffff |
colorFillSecondary | rgba(0,0,0,0.06) |
colorIcon | rgba(0,0,0,0.45) |
colorIconHover | rgba(0,0,0,0.88) |
colorPrimary | #2f54eb |
colorSplit | rgba(5,5,5,0.06) |
colorText | rgba(0,0,0,0.88) |
colorTextDisabled | rgba(0,0,0,0.25) |
colorTextHeading | rgba(0,0,0,0.88) |
colorTextLightSolid | #fff |
colorTextTertiary | rgba(0,0,0,0.45) |
borderRadiusLG | 8 |
borderRadiusSM | 4 |
controlHeightLG | 40 |
controlHeightSM | 24 |
controlItemBgActive | #f0f5ff |
controlItemBgHover | rgba(0,0,0,0.04) |
fontFamily | -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji' |
fontSize | 14 |
fontWeightStrong | 600 |
lineHeight | 1.5714285714285714 |
lineType | solid |
lineWidth | 1 |
lineWidthBold | 2 |
marginXS | 8 |
marginXXS | 4 |
motionDurationMid | 0.2s |
motionDurationSlow | 0.3s |
padding | 16 |
paddingSM | 12 |
paddingXS | 8 |
paddingXXS | 4 |
screenXS | 480 |
ConfigProvider.calendar
class, style, classNames and styles are supported. Local semantic styles come after the context; style of the root has final precedence. The nested calendar object replaces the entire parent object.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 01 | 02 | 03 |
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
01 | 02 | 03 | 04 | 05 | 06 | 07 |
<script lang="ts">
import dayjs from 'dayjs';
import { Calendar, ConfigProvider } from '@woodger/antd';
</script>
<ConfigProvider calendar={{
styles: {
root: `
border: 2px solid #722ed1;
border-radius: 8px;
`,
header: 'padding-inline:12px'
}
}}>
<Calendar fullscreen={false} defaultValue={dayjs('2026-10-15')} />
</ConfigProvider>
FAQ
How to get the date specifically from a cell?
Use onSelect with info.source=date. onChange is also called on changes from the header, and reselecting the day can only be reported by onSelect.
How to set the language and start of the week?
Match locale or ConfigProvider.locale with Day.js locale. The first day of the week is determined by the corresponding language settings.
cellRender replaces all day?
It complements the cell. To replace internal content, use fullCellRender; The original markup is available via info.originNode.
Why does validRange use startOf/endOf?
Boundaries are compared as timestamps, without automatic time discarding. Expand them explicitly if full days are needed.
Events for several days change the value type?
No, value remains one date. The stripes are built by the example from the application's own data.
Is it possible to use another date library?
generateCalendar accepts the CalendarGenerateConfig adapter and creates a component for your date type. Standard Calendar uses Dayjs.