New to Kendo UI for jQuery? Download free 30-day trial

DatePicker Appearance

As of Kendo UI R1 2022, the DatePicker widget uses brand new rendering.

In this article, you will find information about the new rendering of the Kendo UI DatePicker.

For additional information regarding the decision behind these changes, visit the Rendering Components article.

For a live example, visit the Appearance Demo of the DatePicker.

Options

The Kendo UI DatePicker supports the following styling options:

  • size—configures the overall size of the component.
  • rounded—configures the border radius of the component.
  • fillMode—configures how the color is applied to the component.

Size

The size option controls how big or small the rendered DatePicker looks. The structure of the class is k-input-{size}.

The following values are available for the size option:

  • sm—small size
  • md—medium size
  • lg—large size

The following example demonstrates how to configure the size of the component through the widget configuration:

<input id="datepicker" />
<script>
$("#datepicker").kendoDatePicker({
    size: "medium"
});
</script>

The default size value is medium and it is applied to the wrapping span element through the k-input-md class.

<span class="k-datepicker k-input k-input-md">
</span>

Rounded

The rounded option controls how much border radius is applied to the rendered DatePicker. The structure of the class is k-rounded-{size}.

The following values are available for the rounded option:

  • sm—small border radius
  • md—medium border radius
  • lg—large border radius
  • full—largest border radius

The following example demonstrates how to configure the rounded of the component through the widget configuration:

<input id="datepicker" />
<script>
$("#datepicker").kendoDatePicker({
    rounded: "medium"
});
</script>

The default rounded value is medium and it is applied to the wrapping span element through the k-rounded-md class.

<span class="k-datepicker k-input k-rounded-md">
</span>

FillMode

The fillMode option controls the way the color is applied to the rendered DatePicker. The structure of the class is k-input-{fillMode}.

The following values are available for the fillMode option:

  • solid
  • flat
  • outline

The following example demonstrates how to configure the size of the component through the widget configuration:

<input id="datepicker" />
<script>
$("#datepicker").kendoDatePicker({
    fillMode: "solid"
});
</script>

The default fillMode value is solid and it is applied to the wrapping span element through the k-input-solid class.

<span class="k-datepicker k-input k-input-solid">
</span>

Old vs New Rendering

The old rendering of the component consisted of several wrapping elements:

  • The outer span wrapper with the k-datepicker and k-widget classes.

    <span class="k-widget k-datepicker">
    </span>
    
  • The inner span wrapper with the k-picker-wrap class.

    <span class="k-picker-wrap k-state-default">
    </span>
    
  • The input element with the k-input class. This element is a child of the k-picker-wrap span.

    <input class="k-input" role="combobox" >
    </span>
    
  • The button span element with k-select class. This element is a child of the k-picker-wrap span and renders the button which expands the calendar on click.

    <span unselectable="on" class="k-select" role="button">
    </span>
    
  • The icon span element with the k-icon class. This element is a child of the k-select span and renders the calendar icon.

    <span class="k-icon k-i-calendar">
    

The following example demonstrates the full version of the old rendering:

<span class="k-widget k-datepicker">
  <span class="k-picker-wrap k-state-default">
    <input class="k-input" role="combobox" >
    <span unselectable="on" class="k-select" role="button">
       <span class="k-icon k-i-calendar">
    </span>
  </span>
 </span>
</span>

The new rendering of the component consists of a single wrapping span element that contains the child input and button elements:

  • The span element controls the overall appearance of the widget and has the following class structure:

    <span class="k-datepicker k-input k-input-md k-rounded-md k-input-solid">
    </span>
    
  • The input element controls the appearance of the DatePicker itself and has the following class structure:

    <input type="text" class="k-input-inner" value="..." placeholder="..." />
    
  • The button element controls the appearance of the button that expands the calendar view and has the following class structure:

    <button type="button" class="k-input-button k-button k-icon-button k-button-md k-button-solid k-button-solid-base">
    </button>
    
  • The inner span element renders the calendar icon of the DatePicker and has the following class structure:

    <span class="k-button-icon k-icon k-i-calendar"></span>
    

The following example demonstrates how to configure the appearance of the component through the widget configuration:

<input id="datepicker" />
<script>
$("#datepicker").kendoDatePicker({
    size: "medium",
    rounded: "medium",
    fillMode: "solid"
});
</script>

The following example demonstrates the full version of the new rendering:

<span class="k-datepicker k-input k-input-md k-rounded-md k-input-solid">
  <input type="text" class="k-input-inner" value="..." placeholder="..." />
  <button type="button" class="k-input-button k-button k-icon-button k-button-md k-button-solid k-button-solid-base">
    <span class="k-button-icon k-icon k-i-calendar"></span>
  </button>
</span>

Visual Backwards Compatibility

In order to achieve the same look and feel as the old rendering, the element references must be updated. Visit the CSS Classes Migration and JQuery Selectors Migration sections of the Styling Overview article for additional information.

The new styling and rendering supports only the default options when you use a LESS theme.

Previously, a reference to the DatePicker input element was obtainable through the k-input class.

$(".k-input") // Returns a reference to the input element in the old rendering.

With the new rendering, the DatePicker input element must be targeted by using the k-input-inner class.

$(".k-input-inner") // Returns a reference to the input element in the new rendering.

Previously, a reference to the button element was obtainable through the k-select class.

$(".k-select") // Returns a reference to the calendar button element in the old rendering.

With the new rendering, a reference to the button element is obtainable through the k-button and k-input-button classes.

$(".k-button") // Returns a reference to the calendar button element in the new rendering.
$(".k-input-button") // Returns a reference to the calendar button element in the new rendering.

See Also

In this article