Telerik UI for ASP.NET Core Switch Basic Usage

Loading Demo...
  • EXAMPLE
  • VIEW SOURCE
  • Edit in Telerik REPL
HtmlHelper
TagHelper
Files:
index.cshtml
IndexController.cs
Index_TagHelper.cshtml

Also available for:

CLIENT-SIDE API SERVER-SIDE API
devcraft ninja image

The Switch component is part of Telerik UI for ASP.NET Core, a professional grade UI library with 110+ components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.

Description

The Telerik UI for ASP.NET Core Switch is a component that displays two exclusive choices–checked and unchecked. Also known as a Toggle button, the Switch control supports configuration options for easy customization.

The current example displays a common use-case scenario for a Switch component.

The ASP.NET Core Switch control is part of Telerik UI for ASP.NET Core, a professional-grade UI library with 110+ components for building modern and feature-rich web applications. The Switch is a server-side wrapper for the Kendo UI for jQuery Switch component and supports an HtmlHelper and a TagHelper mode.

Functionality and Features

  • Label messages—Define the texts of the checked and unchecked Switch labels.
  • Enabled, disabled, and readonly state—Choose to enable, disable, or make the Switch read-only. For example, if you may want to disable the input for non-authorized users.
  • Bind-value and valueSet and get the Switch value, and use the SwitchFor() configuration to bind the component to a Model property.
  • Appearance—Set the size and radius of the track and thumb border.
  • API—Use the API functions to dynamically change the state of the Switch.
  • Accessibility, keyboard navigation, and RTL support—The Switch is accessible for screen readers, supports WAI-ARIA attributes, and delivers keyboard shortcuts for faster navigation. The component also enables you to render it in a right-to-left direction.

Additional Apps

This Switch example is part of unique collection of hundreds of ASP.NET Core demos, with which you can see all Telerik ASP.NET Core components and their features in action. View the source code of the demos from the library or directly adapt, and edit them and their theme appearance in Telerik REPL for ASP.NET Core or ThemeBuilder.

Support & Learning Resources

Additional Resources