alexa
menu

Blazor Toolkit

    Show / Hide Table of Contents

    Class CalendarBase<T>

    Represents a calendar component that displays a Gregorian calendar and allows users to select dates with full support for localization, min/max constraints, and custom behaviors.

    Inheritance
    System.Object
    SfBaseComponent
    SfInputBase<T>
    CalendarBase<T>
    SfCalendar<TValue>
    SfDatePicker<TValue>
    Implements
    System.IAsyncDisposable
    Inherited Members
    SfBaseComponent.DisposeAsync()
    SfInputBase<T>.CssClass
    SfInputBase<T>.Disabled
    SfInputBase<T>.EnablePersistence
    SfInputBase<T>.ID
    SfInputBase<T>.ValidateOnInput
    SfInputBase<T>.Value
    SfInputBase<T>.ValueChanged
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.APPEND
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.APPENDICON
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.ARIADISABLED
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.BaseAutocomplete
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.BaseFloatLabelType
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.BaseHtmlAttributes
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.BaseInputAttributes
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.BaseIsReadOnlyInput
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.BasePlaceholder
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.BaseReadOnly
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.BaseShowClearButton
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.BaseTabIndex
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.BaseWidth
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.BlurHandlerAsync(System.String, System.Boolean)
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.ChangeHandlerAsync(Microsoft.AspNetCore.Components.ChangeEventArgs)
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.ChildContent
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.CLEARICON
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.CLEARICONHIDE
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.ClickStopPropagation
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.ComponentReference
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.ContainerAttributes
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.ContainerClass
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.ContainerHtmlAttributes
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.CONTROLCONTAINER
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.CONTROLOLDCONTAINER
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.DataId
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.DECREMENT
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.DECREMENTHEADING
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.DecrementTitle
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.DISABLE
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.DISABLEDATTRIBUTE
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.DISABLEICON
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.DisposeAsyncCore()
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.FLOATINPUT
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.FloatLabel
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.FLOATLABELBOTTOM
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.FLOATLABELTOP
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.FLOATTEXT
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.FocusHandlerAsync(Microsoft.AspNetCore.Components.Web.FocusEventArgs)
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.FocusOutHandlerAsync(Microsoft.AspNetCore.Components.Web.FocusEventArgs)
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.FormatValue(System.String)
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.FormatValueAsString(T)
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.GROUPICON
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.INCREMENT
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.INCREMENTHEADING
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.IncrementTitle
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.INPUT
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.INPUTBASECLASS
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.InputEditContext
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.INPUTFOCUS
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.INPUTGROUP
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.InputHandlerAsync(Microsoft.AspNetCore.Components.ChangeEventArgs)
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.InputHtmlAttributes
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.IsBindInputEvent
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.IsClearButtonClicked
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.IsFocused
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.IsValueTemplate
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.ListOfButtons
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.MouseDownSpinnerPrevent
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.MULTILINE
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.MultilineInput
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.OnAfterRenderAsync(System.Boolean)
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.OnChange
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.OnChangeHandlerAsync(Microsoft.AspNetCore.Components.ChangeEventArgs)
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.OnInitializedAsync()
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.OnInputHandlerAsync(Microsoft.AspNetCore.Components.ChangeEventArgs)
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.OnParametersSetAsync()
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.OnPaste
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.OnPasteHandlerAsync(Microsoft.AspNetCore.Components.Web.ClipboardEventArgs)
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.PREPEND
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.PREPENDICON
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.PreventIconHandler
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.RootClass
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.SetEnabled()
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.SPACE
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.SpinButton
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.SPINDOWN
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.SPINUP
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.ValueExpression
    Syncfusion.Blazor.Toolkit.Inputs.SfInputBase<T>.WireClearBtnEventsAsync()
    Namespace: Syncfusion.Blazor.Toolkit.Calendars
    Assembly: Syncfusion.Blazor.Toolkit.dll
    Syntax
    public class CalendarBase<T> : SfInputBase<T>, IAsyncDisposable
    Type Parameters
    Name Description
    T

    Specifies the supported value type for the calendar's selected date (e.g., DateTime, DateOnly, DateTimeOffset).

    Remarks

    The CalendarBase<T> class is the base for Syncfusion Blazor Calendar control. It enables date selection, localization, keyboard navigation, and advanced features such as restricted selection by min/max dates and multiple calendar views. It supports conversion between Gregorian and Hijri calendars. Customization for keyboard shortcuts and rendering can be achieved through exposed events and parameters.

    Examples

    The following example demonstrates how to instantiate the CalendarBase component allowing selection between a date range:

    <SfCalendar Min="@new DateTime(2020, 1, 1)" Max="@new DateTime(2025, 12, 31)" FirstDayOfWeek="1" DayHeaderFormat="DayHeaderFormats.Wide"/>

    Constructors

    CalendarBase()

    Declaration
    public CalendarBase()

    Properties

    CalendarMode

    Gets or sets the calendar system type, such as Gregorian or Hijri.

    Declaration
    public CalendarType CalendarMode { get; set; }
    Property Value
    Type Description
    CalendarType

    A CalendarType enum value specifying the calendar system to be used in the component (e.g., Gregorian, Hijri).

    Remarks

    Use this property to enable the selection and display of dates in different calendar systems.

    Examples

    Display the calendar using the Hijri system:

    <SfCalendar CalendarMode="CalendarType.Hijri" />

    DayHeaderFormat

    Gets or sets the display format for day names shown in the calendar's header.

    Declaration
    public DayHeaderFormats DayHeaderFormat { get; set; }
    Property Value
    Type Description
    DayHeaderFormats

    A DayHeaderFormats value specifying the header day name format (Short, Narrow, Abbreviated, Wide). Default is Short.

    Remarks

    This property configures the format of day names in the calendar header row, allowing customization of the day label presentation for various cultures or UI requirements.

    Examples

    Show abbreviated day names (e.g., Mon, Tue, Wed):

    <SfCalendar DayHeaderFormat="DayHeaderFormats.Abbreviated" />

    Depth

    Gets or sets the maximum navigation depth in the calendar (e.g., Month, Year, Decade).

    Declaration
    public CalendarView Depth { get; set; }
    Property Value
    Type Description
    CalendarView

    A CalendarView value specifying the maximum depth users can navigate. Typical values are Month, Year, or Decade.

    Remarks

    The Depth must be smaller than Start to properly restrict view navigation.

    Examples

    Allow users to navigate up to the Year view only:

    <SfCalendar Start="CalendarView.Month" Depth="CalendarView.Year" />

    FirstDayOfWeek

    Gets or sets the first day of the week in the calendar view.

    Declaration
    public int FirstDayOfWeek { get; set; }
    Property Value
    Type Description
    System.Int32

    An int value representing the first day of the week, where 0 = Sunday, 1 = Monday, etc. Default is based on the current culture.

    Remarks

    Use this property to change the calendar's week layout to start on a different day (for example, Monday instead of Sunday).

    Examples

    Set the calendar's first day of the week to Monday:

    <SfCalendar FirstDayOfWeek="1" />

    KeyConfigs

    Gets or sets the custom keyboard actions for the calendar component.

    Declaration
    public Dictionary<string, object> KeyConfigs { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.Object>

    A System.Collections.Generic.Dictionary<, > that maps key action names to custom shortcut values.

    Remarks

    Use this property to provide keyboard accessibility and localization, such as customizing shortcuts for different keyboard layouts.

    Examples

    Provide custom key actions for German keyboards:

    <SfCalendar KeyConfigs="@myKeyConfigs" />
    @code {
      Dictionary<string, object> myKeyConfigs = new() { { "moveRight", "Alt+RightArrow" } };
    }

    Max

    Gets or sets the maximum selectable date for the calendar.

    Declaration
    public virtual DateTime Max { get; set; }
    Property Value
    Type Description
    System.DateTime

    A DateTime value specifying the latest date a user can select. The default is 31-Dec-2099.

    Remarks

    Use this property to restrict user selection to dates before or equal to the specified maximum.

    Examples

    Set the maximum date to 31-Dec-2025:

    <SfCalendar Max="@new DateTime(2025,12,31)" />

    Min

    Gets or sets the minimum selectable date for the calendar.

    Declaration
    public virtual DateTime Min { get; set; }
    Property Value
    Type Description
    System.DateTime

    A DateTime value specifying the earliest date a user can select. The default is 01-Jan-1900.

    Remarks

    Use this property to restrict user selection to dates on or after the specified minimum.

    Examples

    Set the minimum date to 1-Jan-2000:

    <SfCalendar Min="@new DateTime(2000,1,1)" />

    ShowTodayButton

    Gets or sets a value that determines whether the today button is displayed in the calendar UI.

    Declaration
    public bool ShowTodayButton { get; set; }
    Property Value
    Type Description
    System.Boolean

    true to show the today button; otherwise, false. Default is true.

    Remarks

    The today button allows users to quickly select the current date in the calendar.

    Examples

    Hide the today button:

    <SfCalendar ShowTodayButton="false" />

    Start

    Gets or sets the initial calendar view displayed when the calendar is opened.

    Declaration
    public CalendarView Start { get; set; }
    Property Value
    Type Description
    CalendarView

    A CalendarView value determining whether the initial view starts from Month, Year, or Decade. Default is Month.

    Remarks

    Use this property to control which navigation level users see first when they open the calendar.

    Examples

    Set the calendar to open on the year view:

    <SfCalendar Start="CalendarView.Year" />

    WeekNumber

    Gets or sets a value indicating whether the calendar displays the week number in the UI.

    Declaration
    public bool WeekNumber { get; set; }
    Property Value
    Type Description
    System.Boolean

    true to display the week number; otherwise, false.

    Remarks

    When enabled, a week number column is shown for each date row in the calendar.

    WeekRule

    Gets or sets the rule used to determine the first week of the year in the calendar.

    Declaration
    public CalendarWeekRule WeekRule { get; set; }
    Property Value
    Type Description
    System.Globalization.CalendarWeekRule

    A System.Globalization.CalendarWeekRule value that specifies how the first week of the year is calculated.

    Remarks

    The default is culture-dependent. Valid options include FirstDay, FirstFullWeek, and FirstFourDayWeek.

    Examples

    Specify the calendar week rule:

    <SfCalendar WeekRule="CalendarWeekRule.FirstFourDayWeek" />

    Methods

    ConvertToGregorian(String, String)

    Converts a formatted Hijri date string to a Gregorian System.DateTime object.

    Declaration
    public T ConvertToGregorian(string hijriDate, string format)
    Parameters
    Type Name Description
    System.String hijriDate

    The Hijri date string to convert, formatted according to the specified format.

    System.String format

    The format string that specifies the structure of the hijriDate. Valid format components include "dd" for day, "MM" for month (numeric), "MMM"/"MMMM" for month name, "yyyy" for year, and "HH"/"mm"/"ss" for time.

    Returns
    Type Description
    T

    A System.DateTime object in Gregorian format representing the date and time specified in the Hijri hijriDate.

    Remarks

    This method splits the hijriDate and format into individual components, parses each component to extract day, month, year, and time values, and converts them from Hijri to Gregorian. It assumes that the hijriDate is in the Hijri calendar.

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when hijriDate or format is null or empty.

    ConvertToHijri(T, String)

    Converts a Gregorian System.DateTime object to a formatted Hijri date string.

    Declaration
    public string ConvertToHijri(T gregorianDate, string format)
    Parameters
    Type Name Description
    T gregorianDate

    The Gregorian date to be converted to Hijri, of type T.

    System.String format

    The format string specifying the output structure of the Hijri date. Supports standard date format specifiers such as "dd", "MM", "MMM", "MMMM", "yyyy", and time components.

    Returns
    Type Description
    System.String

    A string representing the Hijri date formatted according to the specified format.

    Remarks

    This method converts a System.DateTime value from Gregorian to Hijri and formats it. If the format string contains "MMM" or "MMMM", it replaces the month part with a Hijri month name (abbreviated or full, depending on the format).

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when format is null.

    Implements

    System.IAsyncDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved