New to Telerik UI for ASP.NET MVC? Download free 30-day trial

Badge ToggleButton

The ToggleButton can incorporate a Badge to enhance the meaning of the text content.

The ToggleButton provides the Badge() configuration method for configuring the ToggleButton's Badge. The API exposes several methods that you can use to customize the appearance of the Badge:

  • Shape()—Specifies the shape of the badge. The default value is Rounded.
  • Size()—Sets the proportions of the badge. The default size is Medium
  • ThemeColor()—Configures the default theme color for the badge. The default value is Primary.
  • Position()—Defines the position of the Badge of the badge. The default value is Inline.
  • Fill()—Species the fill mode of the badge. The default value is Solid.
  • Visible()—Configures the visible state of the badge.
  • Align()—Defines the alignment of the badge.
  • CutoutBorder()—Specifies wether or not to render additional cutout border around the badge.
    @(Html.Kendo().ToggleButton()
        .Name("toggleButton")
        .Content("Text ToggleButton")
        .Badge(badge => badge
            .Text("+5")
            .CutoutBorder(true)
            .Shape(BadgeShape.Rectangle)
            .Size(BadgeSize.Large)
            .ThemeColor(BadgeColor.Success)
            .Position(BadgePosition.Outside)
            .Align(BadgeAlign.TopEnd)
        )
    )

The Icon() method displays the appropriate Kendo UI for jQuery font icon icon. The icon is rendered inside the badge by a span.k-icon or span.k-svg-icon element.

    @(Html.Kendo().ToggleButton()
        .Name("toggleButton")
        .Content("Text ToggleButton")
        .Badge(badge => badge
            .Shape(BadgeShape.Circle)
            .Size(BadgeSize.Large)
            .ThemeColor(BadgeColor.Success)
            .Position(BadgePosition.Edge)
            .Align(BadgeAlign.TopStart)
            .Icon("save")
        )
    )

See Also

In this article