New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Defines the fluent API for configuring the Kendo UI Button

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class ButtonBuilder : WidgetBuilderBase<Button, ButtonBuilder>, IHtmlContent

Inheritance: objectHelperResultWidgetBuilderBase<Button, ButtonBuilder>ButtonBuilder

Implements: IHtmlContent

Inherited Members WidgetBuilderBase<Button, ButtonBuilder>.ToComponent()WidgetBuilderBase<Button, ButtonBuilder>.Expression(string)WidgetBuilderBase<Button, ButtonBuilder>.Explorer(ModelExplorer)WidgetBuilderBase<Button, ButtonBuilder>.Name(string)WidgetBuilderBase<Button, ButtonBuilder>.Deferred(bool)WidgetBuilderBase<Button, ButtonBuilder>.HtmlAttributes(object)WidgetBuilderBase<Button, ButtonBuilder>.HtmlAttributes(IDictionary<string, object>)WidgetBuilderBase<Button, ButtonBuilder>.ScriptAttributes(object, bool)WidgetBuilderBase<Button, ButtonBuilder>.ScriptAttributes(IDictionary<string, object>, bool)WidgetBuilderBase<Button, ButtonBuilder>.Render()WidgetBuilderBase<Button, ButtonBuilder>.ToHtmlString()WidgetBuilderBase<Button, ButtonBuilder>.WriteTo(TextWriter, HtmlEncoder)WidgetBuilderBase<Button, ButtonBuilder>.ToClientTemplate()WidgetBuilderBase<Button, ButtonBuilder>.AsModule(bool)WidgetBuilderBase<Button, ButtonBuilder>.ComponentWidgetBuilderBase<Button, ButtonBuilder>.ContainerHelperResult.WriteTo(TextWriter, HtmlEncoder)HelperResult.WriteActionobject.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the ButtonBuilder class.

C#
public ButtonBuilder(Button component)
Parameters:componentButton

Methods

If set to true a default overlay badge will be displayed. If set to a string, an ovelay with content set to the specified string will be displayed. Can be set to a JavaScript object which represents the configuration of the Badge widget.

C#
public ButtonBuilder Badge(Action<ButtonBadgeSettingsBuilder> configurator)
Parameters:configuratorAction<ButtonBadgeSettingsBuilder>

The ButtonBadgeSettingsBuilder for the badge setting.

Returns:

ButtonBuilder

Returns the current instance of ButtonBuilder .

If set to true a default overlay badge will be displayed. If set to a string, an ovelay with content set to the specified string will be displayed. Can be set to a JavaScript object which represents the configuration of the Badge widget.

C#
public ButtonBuilder Badge(bool enabled)
Parameters:enabledbool

Enables or disables the badge option.

Returns:

ButtonBuilder

Returns the current instance of ButtonBadgeSettingsBuilder .

Sets the value of the badge

C#
public ButtonBuilder Badge(string value)
Parameters:valuestring

The value of the badge.

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Example:
C#
@( Html.Kendo().Button()
.Name("Button")
.Badge("inactive")
)

Sets the HTML content of the Button.

C#
public ButtonBuilder Content(Action content)
Parameters:contentAction

The action which renders the HTML content.

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Example:
C#
@(  Html.Kendo().Button()
.Name("Button1")
.Content(() =&gt; { &gt;%
&lt;p&gt;Content&lt;/p&gt;
%&lt;})
.Render();
)

Sets the HTML content of the Button.

C#
public ButtonBuilder Content(Func<object, object> content)
Parameters:contentFunc<object, object>

The Razor template for the HTML content.

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Example:
C#
@(Html.Kendo().Button()
.Name("Button1")
.Content(@&lt;p&gt;Content&lt;/p&gt;)
.Render();)

Sets the HTML content of the Button.

C#
public ButtonBuilder Content(string content)
Parameters:contentstring

The HTML content.

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Example:
C#
@( Html.Kendo().Button()
.Name("Button")
.Content("&lt;p&gt;Content&lt;/p&gt;")
)

Indicates whether the Button should be enabled or disabled. By default, it is enabled, unless a disabled="disabled" attribute is detected.

C#
public ButtonBuilder Enable(bool value)
Parameters:valuebool

The value for Enable

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Defines a Kendo UI font or SVG icon that is rendered after the Button text.

C#
public ButtonBuilder EndIcon(string value)
Parameters:valuestring

The value for EndIcon

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Configures the client-side events.

C#
public ButtonBuilder Events(Action<ButtonEventBuilder> configurator)
Parameters:configuratorAction<ButtonEventBuilder>

The client events action.

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Example:
C#
@(Html.Kendo().Button()
.Name("Button")
.Events(events =&gt; events
.Click("onClick")
)
)

Sets a value controlling how the color is applied.

C#
public ButtonBuilder FillMode(ButtonFillMode value)
Parameters:valueButtonFillMode

The value for FillMode

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Defines a name of an existing icon in the Kendo UI theme sprite. The icon will be applied as background image of a span element inside the Button. The span element can be added automatically by the widget, or an existing element can be used, if it has a k-icon CSS class applied. For a list of available icon names, please refer to the Icon Button article.Set this option to an icon descriptor such as { name: "gear", variant: "outline" }. The variant can be outline, solid, or duotone; it applies to SVG rendering and is ignored for font icons.

C#
public ButtonBuilder Icon(Action<ButtonIconSettingsBuilder> configurator)
Parameters:configuratorAction<ButtonIconSettingsBuilder>

The ButtonIconSettingsBuilder for the icon setting.

Returns:

ButtonBuilder

Returns the current instance of ButtonBuilder .

Defines a name of an existing icon in the Kendo UI theme sprite. The icon will be applied as background image of a span element inside the Button. The span element can be added automatically by the widget, or an existing element can be used, if it has a k-icon CSS class applied. For a list of available icon names, please refer to the Icon Button article.Set this option to an icon descriptor such as { name: "gear", variant: "outline" }. The variant can be outline, solid, or duotone; it applies to SVG rendering and is ignored for font icons.

C#
public ButtonBuilder Icon(string icon)
Parameters:iconstring

The icon.

Returns:

ButtonBuilder

Returns the current instance of ButtonBuilder .

Defines a CSS class - or multiple classes separated by spaced - which are applied to a span element inside the Button. Allows the usage of custom icons.

C#
public ButtonBuilder IconClass(string value)
Parameters:valuestring

The value for IconClass

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Defines a URL, which will be used for an img element inside the Button. The URL can be relative or absolute. In case it is relative, it will be evaluated with relation to the web page URL.The img element can be added automatically by the widget, or an existing element can be used, if it has a k-image CSS class applied.

C#
public ButtonBuilder ImageUrl(string value)
Parameters:valuestring

The value for ImageUrl

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Sets a value controlling the border radius.

C#
public ButtonBuilder Rounded(Rounded value)
Parameters:valueRounded

The value for Rounded

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Controls the overall physical size of a button. Valid values are: "xsmall", "small", "medium", and "large". When undefined (the default), the theme controls the default size.The "none" value is deprecated. Use custom CSS to customize the size.

C#
public ButtonBuilder Size(ButtonSize value)
Parameters:valueButtonSize

The value for Size

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Defines a CSS class (or multiple classes separated by spaces), which will be used for applying a background image to a span element inside the Button. In case you want to use an icon from the Kendo UI theme sprite background image, it is easier to use the icon property.The span element can be added automatically by the widget, or an existing element can be used, if it has a k-sprite CSS class applied.

C#
public ButtonBuilder SpriteCssClass(string value)
Parameters:valuestring

The value for SpriteCssClass

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Sets the Button HTML tag. A button tag is used by default.

C#
public ButtonBuilder Tag(string tag)
Parameters:tagstring

The name of the Html element from which the button is initialized.

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.

Example:
C#
@( Html.Kendo().Button()
.Name("Button")
.Tag("a")
)

Sets the color of the component according to the applied theme.

C#
public ButtonBuilder ThemeColor(ThemeColor value)
Parameters:valueThemeColor

The value for ThemeColor

Returns:

ButtonBuilder

Returns the current ButtonBuilder instance.