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

Appearance

In this article, you will find information about the styling options and rendering of the Kendo UI Switch.

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

Options

The Kendo UI Switch supports the following styling options:

  • size—configures the overall size of the component.
  • trackRounded—configures the track's border radius.
  • thumbRounded—configures the thumb's border radius.

Size

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

The following values are available for the size option:

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

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

The example below shows a basic Switch configuration and how to set the size option:

    <input id="switch" />
    <script>
        $("#switch").kendoSwitch({
            size:"large"
        })
    </script>

The option affects the span.k-switch element:

<span class="k-switch k-switch-on k-switch-lg">
</span>

TrackRounded

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

The following values are available for the trackRounded option:

  • sm—small border radius
  • md—medium border radius
  • lg—large border radius
  • full—ellipse-like border radius
  • none—unset

The default value is full and it is applied to the wrapping span element that contains the On/Off labels through the k-rounded-full class.

The example below shows a basic Switch configuration and how to set the trackRounded option:

    <input id="switch" />
    <script>
        $("#switch").kendoSwitch({
            trackRounded:"large"
        })
    </script>

The option affects the span element that wraps the On/Off labels:

<span class="k-switch-track k-rounded-lg">
</span>

ThumbRounded

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

The following values are available for the thumbRounded option:

  • sm—small border radius
  • md—medium border radius
  • lg—large border radius
  • full—ellipse-like border radius
  • none—unset

The default value is full and it is applied to the span element for the thumb through the k-rounded-full class.

The example below shows a basic Switch configuration and how to set the thumbRounded option:

    <input id="switch" />
    <script>
        $("#switch").kendoSwitch({
            thumbRounded:"large"
        })
    </script>

The option affects the span element for the Switch handle:

<span class="k-switch-thumb k-rounded-md">
</span>

Rendering

Starting with version R1 2022, the component has a new rendering. For additional information on the decision behind these changes, visit the Components Rendering Overview article.

To review the latest rendering of the component, refer to the HTML specifications in the Kendo UI Themes Monorepo. The tests folder of the repository contains the rendering for all flavors of the components, providing a clear reference for how their elements are structured. The rendering information can help you customize a component's appearance and behavior by applying custom CSS or JavaScript to suit specific design or functional requirements.

See Also

In this article