FlexibleCalendar 1.0.10

dotnet add package FlexibleCalendar --version 1.0.10
                    
NuGet\Install-Package FlexibleCalendar -Version 1.0.10
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FlexibleCalendar" Version="1.0.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FlexibleCalendar" Version="1.0.10" />
                    
Directory.Packages.props
<PackageReference Include="FlexibleCalendar" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FlexibleCalendar --version 1.0.10
                    
#r "nuget: FlexibleCalendar, 1.0.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FlexibleCalendar@1.0.10
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FlexibleCalendar&version=1.0.10
                    
Install as a Cake Addin
#tool nuget:?package=FlexibleCalendar&version=1.0.10
                    
Install as a Cake Tool

FlexibleCalendar

EN

FlexibleCalendar is a Blazor component for displaying a calendar with the ability to color specific dates using System.Drawing.Color and support for interactive actions.

Quick Start

  1. Add the NuGet package FlexibleCalendar to your Blazor project.
  2. Import the namespace:
@using FlexibleCalendar.Calendar

<Calendar MonthsToShow="6" CalendarColumns="3" />

This will display 6 months starting from 2025-01-01, 3 horizontally and 2 vertically.

Usage Example

@using FlexibleCalendar.Calendar

<Calendar MonthsToShow="4"
          CalendarColumns="2"
          DateBackgroundCssVariable="--bs-body-bg"
          Events="_events"
          OnDayClick="OnDayClickHandler" />
private List<CalendarEvent> _events =
    [new(DateTime.Now, DateTime.Now.AddDays(7), Color.DarkSeaGreen, Color.Azure),
     new(DateTime.Now.AddDays(9), DateTime.Now.AddDays(15), Color.DarkOrange, Color.Black)];

private void OnDayClickHandler(DateTime date)
{
    // Your code to handle day click
}

Calendar Component Parameters

Parameter Type Description Requirement
MonthsToShow int Number of months to display at once. Allowed values: 1 to 12. Optional. Default is 1.
CalendarColumns int Number of columns for the months grid. Optional. Default is 1.
StartDate DateTime? Start date for the calendar. Defaults to January 1st of the current year. Optional. Default is January 1st of current year.
Culture CultureInfo? Culture for month and weekday names. Optional. Default is en-US.
Events IEnumerable<ICalendarEvent>? Collection of events to display. Each event specifies a date range and colors. Optional. Default is Array.Empty.
OnDayClick EventCallback<DateTime> Event triggered when a day is clicked. Returns the selected date. Optional.
DateBackgroundCssVariable string? CSS variable for the background of date cells (e.g., --my-bg). Used for all dates not in Events. Useful for theme compatibility. Optional.

Event Format

To display events, use objects implementing the ICalendarEvent interface. The default implementation is the CalendarEvent class.

Structure:

public interface ICalendarEvent
{
    DateTime StartDate { get; set; }
    DateTime EndDate { get; set; }
    Color Color { get; set; }
    Color TextColor { get; set; }
}

Styling

The component uses the following CSS classes:

  • .calendar — calendar container
  • .calendar-header — header with navigation
  • .calendar-months-grid — months grid
  • .calendar-month-title — month title
  • .calendar-weekdays — weekdays row
  • .calendar-day — day cell
  • .calendar-day.empty — empty cell (for alignment)

You can override styles in your project or use CSS variables for customization.

RU

Blazor-компонент для отображения календаря с возможностью окраски конкретных дат в различные цвета System.Drawing.Color с поддержкой интерактивных действий

Быстрый старт

  1. Добавьте Nuget пакет FlexibleCalendar на проект в ваш Blazor-проект.
  2. Импортируйте пространство имён:
@using FlexibleCalendar.Calendar

<Calendar MonthsToShow="6" CalendarColumns="3" /> 

Отобразит 6 месяцев, начиная с 2025.01.01, 3 по горизонтали, 2 по вертикали.

Пример использования

@using FlexibleCalendar.Calendar 

<Calendar MonthsToShow="4"
          CalendarColumns="2"
          DateBackgroundCssVariable="--bs-body-bg"
          Events="_events"
          OnDayClick="OnDayClickHandler" />


private List<CalendarEvent> _events =

    [new(DateTime.Now, DateTime.Now.AddDays(7), Color.DarkSeaGreen, Color.Azure),

     new(DateTime.Now.AddDays(9), DateTime.Now.AddDays(15), Color.DarkOrange, Color.Black)];


private void OnDayClickHandler(DateTime date)

{

    // Ваш код обработки клика по дню

}

Параметры компонента Calendar

Параметр Тип Описание Требование
MonthsToShow int Количество месяцев для отображения одновременно. Допустимые значения: от 1 до 12. ==Не обязательно==. По умолчанию 1.
CalendarColumns int Количество колонок для сетки месяцев. ==Не обязательно==, по умолчанию 1.
StartDate DateTime? Дата начала отображения календаря. По умолчанию 1 января текущего года. ==Не обязательно==, по умолчанию 1 января текущего года.
Culture CultureInfo? Культура для названий месяцев и дней недели. ==Не обязательно==, по умолчанию en-US
Events IEnumerable<ICalendarEvent>? Коллекция событий для отображения. Каждое событие задаёт диапазон дат и цвета. ==Не обязательно== по умолчанию Array.Empty
OnDayClick EventCallback<DateTime> Событие, вызываемое при клике по дню. Возвращает выбранную дату. ==Не обязательно==.
DateBackgroundCssVariable string? CSS-переменная для фона ячеек дат (например, --my-bg). Если задана, применяется ко всем датам не входящим в Events. Нужно для совместимости с разными темами, разных css библиотек. ==Не обязательно==.

Формат событий

Для отображения событий используйте объекты, реализующие интерфейс ICalendarEvent, по умолчанию есть класс `CalendarEvent.

Его структура:

public interface ICalendarEvent  
{  
    DateTime StartDate { get; set; }  
    DateTime EndDate { get; set; }  
    Color Color { get; set; }  
    Color TextColor { get; set; }  
}

Стилизация

Компонент использует CSS-классы:

  • .calendar — контейнер календаря

  • .calendar-header — шапка с навигацией

  • .calendar-months-grid — сетка месяцев

  • .calendar-month-title — название месяца

  • .calendar-weekdays — строка дней недели

  • .calendar-day — ячейка дня

  • .calendar-day.empty — пустая ячейка (для выравнивания)

Вы можете переопределить стили в своём проекте или использовать CSS-переменные для кастомизации.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.10 13,545 7/21/2025
1.0.9 236 6/30/2025
1.0.8 202 6/29/2025
1.0.7 154 6/28/2025
1.0.6 183 6/27/2025
1.0.5 180 6/27/2025
1.0.4 195 6/25/2025
1.0.3 196 6/22/2025
1.0.2 196 6/22/2025
1.0.1 173 6/15/2025
1.0.0 178 6/15/2025