This section briefly explains about how to create a simple Switch in your ASP.NET Core application. You can refer ASP.NET Core Getting Started documentation page for introduction part of the system requirements and configure the common specifications.
To create simple Switch add the ejs-switch
tag with id attribute as element
in your Index.cshtml page.
<ejs-switch id="default"></ejs-switch>
public ActionResult Default()
{
return View();
}
After successful compilation of your application, simply press F5
to run the application.
The following example shows a default rendering of Switch.
<ejs-switch id="default"></ejs-switch>
public ActionResult Default()
{
return View();
}
This section explains how to set onLabel
and offLabel
texts on Switch. In the following example, onLabel
is set as ON
and offLabel
is set as OFF
.
<ejs-switch id="default" onlabel="ON" offlabel="OFF"></ejs-switch>
public ActionResult Default()
{
return View();
}
Switch does not have text support for material themes, and does not support long custom text.