Skip to content

KCalendar ​

A container that displays data in calendar form.

Install ​

bash
pnpm add @ikun-ui/calendar
bash
yarn add @ikun-ui/calendar
bash
npm install @ikun-ui/calendar

Basic usage ​

A basic calendar component with Year/Month switch.

Card mode ​

Nested inside a container element for rendering in limited space.

Custom render ​

Custom rendering via slots.

Calendar Props ​

NameTypeDefaultDescription
modemonth | yearyearThe display mode of the calendar.
valueDayjs-The current selected date.
fullscreenbooleantrueWhether to display in full-screen.
validRange[Dayjs, Dayjs][]To set valid range.
disabledDate(currentDate: Dayjs) => boolean-Function that specifies the dates that cannot be selected.
localeobjectdefaultThe calendar's locale.
clsstring''Additional class for component
attrsany{}Additional attributes

Calendar Events ​

NameDescriptionType
selectCallback for when a date is selected, include source info.(v: { date: Dayjs, source: 'month' | 'year' })=> void
panelChangeCallback for when panel changes.(v: { date: Dayjs, mode: 'month' | 'year' })=> void

Calendar Slots ​

NameDescription
headerContent of the header.
monthFullCellContent of the month cell, the content will override the cell
monthCellContent of the month cell, the content will be appended to the cell
dateFullCellContent of the date cell, the content will override the cell.
dateCellContent of the date cell, the content will be appended to the cell

Header slot params ​

typescript
interface SelectOption {
	label: string;
	value: string;
	id: string;
}
typescript
interface HeaderSlotPa {
	// Current mode
	mode: 'year' | 'month';
	// Select callback of ‘year’
	handleYearSelect: (v: { detail: SelectOption }) => void;
	// Select callback of ‘month’
	handleMonthSelect: (v: { detail: SelectOption }) => void;
	// Switch mode callback
	handleMYClick: (v: 'year' | 'month') => void;
	// Select rendering data of ‘year’
	yearList: Array<SelectOption>;
	// Select rendering data of ‘month’
	monthList: Array<SelectOption>;
	// The value of the year selector
	year: SelectOption;
	// The value of the month selector
	month: SelectOption;
}

dateCell slot params ​

typescript
interface dateCellSlotPa {
	// Data used for rendering
	date: { instance: Dayjs };
}

dateFullCell slot params ​

typescript
interface dateFullCellSlotPa {
	// Data used for rendering
	date: { instance: Dayjs };
}

MonthCell slot params ​

typescript
interface monthCellSlotPa {
	// Data used for rendering
	month: Dayjs;
}

MonthFullCell slot params ​

typescript
interface monthFullCellSlotPa {
	// Data used for rendering
	month: Dayjs;
}

MIT Licensed