### Install Vanilla Calendar Pro
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/README.md
Use npm or yarn to add the package to your project.
```sh
npm install vanilla-calendar-pro
# or
yarn add vanilla-calendar-pro
```
--------------------------------
### Install Vanilla Calendar Pro via package manager
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/docs/en/learn/installation-and-usage.mdx
Use npm, yarn, or pnpm to add the package to your project dependencies.
```bash
npm install vanilla-calendar-pro
# or
yarn add vanilla-calendar-pro
# or
pnpm add vanilla-calendar-pro
```
--------------------------------
### Integrate via CDN
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/docs/en/learn/installation-and-usage.mdx
Include the library directly in your HTML file using a CDN link for quick setup without build tools.
```html
```
--------------------------------
### Set Initial Time
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/docs/en/learn/date-management-enable-time-picker.mdx
Defines the starting time upon calendar initialization.
```javascript
```
--------------------------------
### Set Initial Month
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/docs/en/reference/settings.mdx
Defines the starting month (0-11) for the calendar display.
```ts
new Calendar('#calendar', {
selectedMonth: 0,
});
```
--------------------------------
### Integrate with Vue
Source: https://context7.com/uvarov-frontend/vanilla-calendar-pro/llms.txt
Implement a reusable Vue component using the Composition API and script setup.
```vue
```
--------------------------------
### First Weekday Setting
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/docs/en/reference/settings.mdx
Sets the starting day of the week for the calendar display.
```APIDOC
## firstWeekday
### Description
This parameter sets the first day of the week. Specify a number from 0 to 6, where the number represents the day of the week identifier. According to JS standards, the days of the week start with 0, and 0 is Sunday.
### Method
Not Applicable (Configuration Option)
### Endpoint
Not Applicable (Configuration Option)
### Parameters
#### Query Parameters
- **firstWeekday** (Number) - Required - Options: from 0 to 6
### Request Example
```json
{
"firstWeekday": 1
}
```
### Response
#### Success Response (200)
- **firstWeekday** (Number) - The identifier for the first day of the week.
#### Response Example
```json
{
"firstWeekday": 1
}
```
```
--------------------------------
### Set Initial Year
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/docs/en/reference/settings.mdx
Defines the starting year (YYYY) for the calendar display.
```ts
new Calendar('#calendar', {
selectedYear: 2022,
});
```
--------------------------------
### Create VanillaCalendar React Component
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/docs/en/learn/components-for-libraries-react.mdx
This component initializes Vanilla Calendar Pro within a React application. It accepts configuration options and standard HTML attributes. Ensure you have 'vanilla-calendar-pro' installed.
```tsx
import { useEffect, useRef, useState } from 'react';
import { Options, Calendar } from 'vanilla-calendar-pro';
import 'vanilla-calendar-pro/styles/index.css';
interface CalendarProps extends React.HTMLAttributes {
config?: Options,
}
function VanillaCalendar({ config, ...attributes }: CalendarProps) {
const ref = useRef(null);
const [calendar, setCalendar] = useState(null);
useEffect(() => {
if (!ref.current) return;
setCalendar(new Calendar(ref.current, config));
}, [ref, config])
useEffect(() => {
if (!calendar) return;
calendar.init()
}, [calendar])
return (
)
}
export default VanillaCalendar;
```
--------------------------------
### Define First Weekday
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/docs/en/reference/settings.mdx
Sets the starting day of the week using a numeric index from 0 (Sunday) to 6 (Saturday).
```ts
new Calendar('#calendar', {
firstWeekday: 1,
});
```
--------------------------------
### Define Custom Calendar Layout
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/README.md
Configure the calendar structure by defining a custom layout string with component tags. Components are identified by tags starting with # and ending with a slash.
```javascript
new Calendar('#calendar', {
layouts: {
default: `
<#ArrowPrev [month] />
<#Month />
<#Year />
<#ArrowNext [month] />
<#WeekNumbers />
<#Week />
<#Dates />
<#DateRangeTooltip />
<#ControlTime />
`
}
});
```
--------------------------------
### Create a Calendar with Multiple Date Range Selection
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/docs/en/learn/type-multiple.mdx
Configure the calendar to allow users to select date ranges within multiple displayed months. Set `selectionDatesMode` to 'multiple-ranged'. For performance, only start and end dates are stored by default; use `enableEdgeDatesOnly` to control this behavior.
```javascript
const calendar = new VanillaCalendar("#calendar", {
type: "multiple",
selectionDatesMode: "multiple-ranged",
enableEdgeDatesOnly: true, // Optional: optimize performance by storing only start and end dates
});
calendar.show();
```
--------------------------------
### Configure enableEdgeDatesOnly
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/docs/en/reference/settings.mdx
Restricts selection to only the start and end dates in 'multiple-ranged' mode.
```ts
new Calendar('#calendar', {
enableEdgeDatesOnly: true,
});
```
--------------------------------
### Creating an Instance
Source: https://github.com/uvarov-frontend/vanilla-calendar-pro/blob/main/docs/en/reference/creating-an-instance.mdx
Instantiate Vanilla Calendar Pro using a CSS selector or HTML element. The first parameter is the element to initialize the calendar in, and the second optional parameter is for configuration settings.
```APIDOC
## Creating an Instance
`new Calendar()` - creates an instance of **Vanilla Calendar Pro**, which is an encapsulation of the calendar, its settings, and methods.
If you included **Vanilla Calendar Pro** using the `