menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PresetsModel - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PresetsModel

    Represents a predefined date range preset for DateRangePicker components.

    Inheritance
    System.Object
    PresetsModel
    Namespace: Syncfusion.Blazor.Calendars
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class PresetsModel : Object
    Remarks

    This class defines a preset date range option that users can quickly select from a predefined list. Presets are commonly used to provide convenient shortcuts for frequently selected date ranges such as "Last 7 Days", "This Month", "Last Quarter", etc. Each preset contains a start date, end date, and a display label for user interface presentation.

    Examples
    <SfDateRangePicker TValue="DateTime?" Presets="@DatePresets">
    </SfDateRangePicker>
    
    @code {
        List<PresetsModel> DatePresets = new List<PresetsModel>
        {
            new PresetsModel { Label = "Today", Start = DateTime.Today, End = DateTime.Today },
            new PresetsModel { Label = "Last 7 Days", Start = DateTime.Today.AddDays(-6), End = DateTime.Today },
            new PresetsModel { Label = "Last 30 Days", Start = DateTime.Today.AddDays(-29), End = DateTime.Today },
            new PresetsModel { Label = "This Month", Start = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1), End = DateTime.Today }
        };
    }

    Constructors

    PresetsModel()

    Declaration
    public PresetsModel()

    Properties

    End

    Gets or sets the end date of the preset date range.

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

    A System.DateTime value representing the last date in the preset range.

    Remarks

    This property defines the ending boundary of the preset date range. Together with Start, it establishes the complete date range that will be selected when users choose this preset option. The end date should be greater than or equal to the start date for a valid range.

    Label

    Gets or sets the display label for the preset range.

    Declaration
    public string Label { get; set; }
    Property Value
    Type Description
    System.String

    A string containing the human-readable label for the preset. The default value is null.

    Remarks

    This property contains the text that will be displayed to users in the preset selection interface. The label should be descriptive and localized appropriately for the target audience. Common examples include "Today", "Last Week", "This Month", "Last Quarter", etc.

    Start

    Gets or sets the start date of the preset date range.

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

    A System.DateTime value representing the first date in the preset range.

    Remarks

    This property defines the starting boundary of the preset date range. Together with End, it establishes the complete date range that will be selected when users choose this preset option. The start date should be less than or equal to the end date for a valid range.

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