HtmlForgeX

API Reference

Class

EmailButton

Namespace HtmlForgeX.Email
Assembly HtmlForgeX.Email
Base Element
Implements
ILayoutAware ISpaceable<EmailButton> ITextElement<EmailButton> IVisualElement<EmailButton> IRoundable<EmailButton> IRoundable

Represents an email-compatible button component using table-based layout. Applies HeadingMargin between successive buttons and ParagraphMargin when adjacent to other components.

Inheritance

Constructors

EmailButton 2 overloads
public EmailButton() #

Initializes a new instance of the EmailButton class.

public EmailButton(String text, String href, EmailButtonStyle style = Primary) #

Initializes a new instance of the EmailButton class with text and URL.

Parameters

text System.String requiredposition: 0
The button text.
href System.String requiredposition: 1
The button link URL.
style HtmlForgeX.Email.EmailButtonStyle = Primary optionalposition: 2
The button style.

Methods

public EmailButton AsFullWidth(Boolean fullWidth = true) #
Returns: EmailButton

Makes the button full width.

Parameters

fullWidth System.Boolean = true optionalposition: 0
Whether the button should be full width.

Returns

This instance for method chaining.

public override Void EvaluateLayout(LayoutContext context) #
Returns: Void

Applies default border radius for the button based on configuration.

Parameters

context HtmlForgeX.Email.LayoutContext requiredposition: 0
Layout evaluation context.
public override String ToString() #
Returns: String

Converts the EmailButton to its HTML representation.

Returns

HTML string representing the email button.

public virtual EmailButton WithAlignment(Alignment alignment) #
Returns: EmailButton

Sets the text alignment inside the button.

Parameters

alignment HtmlForgeX.Email.Alignment requiredposition: 0
The alignment to apply.

Returns

The current EmailButton for chaining.

WithBackground 2 overloads
public virtual EmailButton WithBackground(RGBColor color) #
Returns: EmailButton

Sets the background color of the button.

Parameters

color System.String requiredposition: 0
The background color value.

Returns

The current EmailButton for chaining.

WithBackground(HtmlForgeX.Email.RGBColor color) #

Sets the background color using an RGBColor instance.

Parameters

color HtmlForgeX.Email.RGBColor required
The RGBColor to apply.

Returns

The current EmailButton for chaining.

WithBorder 2 overloads
public virtual EmailButton WithBorder(BorderWidth width, String customValue = null) #
Returns: EmailButton

Sets the border width using a predefined BorderWidth value.

Parameters

width HtmlForgeX.Email.BorderWidth requiredposition: 0
The predefined border width.
customValue System.String = null optionalposition: 1
Optional custom CSS value.

Returns

The current EmailButton for chaining.

public virtual EmailButton WithBorder(Boolean enabled) #
Returns: EmailButton

Enables or disables the button border.

Parameters

enabled System.Boolean requiredposition: 0

Returns

The current EmailButton for chaining.

WithBorderColor 2 overloads
public virtual EmailButton WithBorderColor(RGBColor color) #
Returns: EmailButton

Sets the border color of the button.

Parameters

color System.String requiredposition: 0
The border color value.

Returns

The current EmailButton for chaining.

WithBorderColor(HtmlForgeX.Email.RGBColor color) #

Sets the border color using an RGBColor instance.

Parameters

color HtmlForgeX.Email.RGBColor required
The RGBColor to apply.

Returns

The current EmailButton for chaining.

public virtual EmailButton WithBorderRadius(String radius) #
Returns: EmailButton

Sets the border radius of the button.

Parameters

radius System.String requiredposition: 0
The CSS radius value.

Returns

The current EmailButton for chaining.

WithColor 2 overloads
public virtual EmailButton WithColor(RGBColor color) #
Returns: EmailButton

Sets the button text color.

Parameters

color System.String requiredposition: 0
The text color value.

Returns

The current EmailButton for chaining.

WithColor(HtmlForgeX.Email.RGBColor color) #

Sets the button text color using an RGBColor instance.

Parameters

color HtmlForgeX.Email.RGBColor required
The RGBColor to apply.

Returns

The current EmailButton for chaining.

WithColors 2 overloads
public EmailButton WithColors(RGBColor backgroundColor, RGBColor textColor, RGBColor borderColor = null) #
Returns: EmailButton

Sets custom colors for the button.

Parameters

backgroundColor System.String requiredposition: 0
The background color.
textColor System.String requiredposition: 1
The text color.
borderColor System.String = null optionalposition: 2
The border color (optional).

Returns

The EmailButton object, allowing for method chaining.

WithColors(HtmlForgeX.Email.RGBColor backgroundColor, HtmlForgeX.Email.RGBColor textColor, HtmlForgeX.Email.RGBColor borderColor) #

Sets custom colors for the button.

Parameters

backgroundColor HtmlForgeX.Email.RGBColor required
The background color.
textColor HtmlForgeX.Email.RGBColor required
The text color.
borderColor HtmlForgeX.Email.RGBColor required
The border color (optional).

Returns

The EmailButton object, allowing for method chaining.

public virtual EmailButton WithFontFamily(String fontFamily) #
Returns: EmailButton

Sets the font family of the button text.

Parameters

fontFamily System.String requiredposition: 0
The font family name.

Returns

The current EmailButton for chaining.

WithFontSize 2 overloads
public virtual EmailButton WithFontSize(EmailFontSize fontSize) #
Returns: EmailButton

Sets the font size of the button text.

Parameters

fontSize System.String requiredposition: 0
The font size value.

Returns

The current EmailButton for chaining.

WithFontSize(HtmlForgeX.Email.EmailFontSize fontSize) #

Sets the font size using a predefined EmailFontSize value.

Parameters

fontSize HtmlForgeX.Email.EmailFontSize required
The predefined font size.

Returns

The current EmailButton for chaining.

WithFontWeight 2 overloads
public virtual EmailButton WithFontWeight(FontWeight fontWeight) #
Returns: EmailButton

Sets the font weight of the button text.

Parameters

fontWeight System.String requiredposition: 0
The font weight value.

Returns

The current EmailButton for chaining.

WithFontWeight(HtmlForgeX.Email.FontWeight fontWeight) #

Sets the font weight using a predefined value.

Parameters

fontWeight HtmlForgeX.Email.FontWeight required
The predefined font weight.

Returns

The current EmailButton for chaining.

public EmailButton WithFullWidth() #
Returns: EmailButton

Makes the button full width.

Returns

The EmailButton object, allowing for method chaining.

public EmailButton WithHref(String href) #
Returns: EmailButton

Sets the button URL.

Parameters

href System.String requiredposition: 0
The button link URL.

Returns

The EmailButton object, allowing for method chaining.

public virtual EmailButton WithLineHeight(String lineHeight) #
Returns: EmailButton

Sets the line height of the button text.

Parameters

lineHeight System.String requiredposition: 0
The line height value.

Returns

The current EmailButton for chaining.

WithRounded 2 overloads
public virtual EmailButton WithRounded(Radius radius = Medium, String customValue = null) #
Returns: EmailButton

Sets the border radius using a predefined size.

Parameters

radius HtmlForgeX.Email.Radius = Medium optionalposition: 0
The border radius size.
customValue System.String = null optionalposition: 1
Custom value when using Custom.

Returns

This instance for method chaining.

public virtual EmailButton WithRounded() #
Returns: EmailButton

Applies a medium border radius to the button.

Returns

The current EmailButton for chaining.

public virtual EmailButton WithRoundingMode(RoundingMode mode) #
Returns: EmailButton

Sets the rounding mode for this button.

Parameters

mode HtmlForgeX.Email.RoundingMode requiredposition: 0
Rounding mode.

Returns

The current instance.

public EmailButton WithSize(EmailButtonSize size) #
Returns: EmailButton

Sets the button size.

Parameters

size HtmlForgeX.Email.EmailButtonSize requiredposition: 0
The button size.

Returns

The EmailButton object, allowing for method chaining.

public EmailButton WithStyle(EmailButtonStyle style) #
Returns: EmailButton

Sets the button style.

Parameters

style HtmlForgeX.Email.EmailButtonStyle requiredposition: 0
The button style.

Returns

The EmailButton object, allowing for method chaining.

public EmailButton WithText(String text) #
Returns: EmailButton

Sets the button text.

Parameters

text System.String requiredposition: 0
The button text.

Returns

The EmailButton object, allowing for method chaining.

WithTextDecoration 2 overloads
public virtual EmailButton WithTextDecoration(TextDecoration decoration) #
Returns: EmailButton

Sets the text decoration style.

Parameters

textDecoration System.String requiredposition: 0
The decoration string.

Returns

The current EmailButton for chaining.

WithTextDecoration(HtmlForgeX.Email.TextDecoration decoration) #

Sets the text decoration using a predefined value.

Parameters

decoration HtmlForgeX.Email.TextDecoration required
The decoration to apply.

Returns

The current EmailButton for chaining.

WithVerticalSpacing 2 overloads
public EmailButton WithVerticalSpacing(EmailSpacing spacing) #
Returns: EmailButton

Sets the vertical spacing around the button using semantic spacing.

Parameters

spacing HtmlForgeX.Email.EmailSpacing requiredposition: 0
The vertical spacing to apply.

Returns

The EmailButton object, allowing for method chaining.

public EmailButton WithVerticalSpacing(EmailSpacing above, EmailSpacing below) #
Returns: EmailButton

Sets different spacing above and below the button.

Parameters

above HtmlForgeX.Email.EmailSpacing requiredposition: 0
The spacing above the button.
below HtmlForgeX.Email.EmailSpacing requiredposition: 1
The spacing below the button.

Returns

The EmailButton object, allowing for method chaining.

Properties

public String Text { get; set; } #

Gets or sets the button text.

public String Href { get; set; } #

Gets or sets the button link URL.

public EmailButtonStyle Style { get; set; } #

Gets or sets the button style type.

public EmailButtonSize Size { get; set; } #

Gets or sets the button size.

public virtual String BackgroundColor { get; set; } #

Gets or sets the background color for custom styling.

public String TextColor { get; set; } #

Gets or sets the text color for custom styling.

public virtual String BorderColor { get; set; } #

Gets or sets the border color for custom styling.

public virtual String FontFamily { get; set; } #

Gets or sets the font family for the button text.

public virtual String FontSize { get; set; } #

Gets or sets the font size. This is overridden by the Size property when set.

public virtual String Color { get; set; } #

Gets or sets the text color.

public virtual String LineHeight { get; set; } #

Gets or sets the line height of the button text.

public virtual String TextAlign { get; set; } #

Gets or sets the text alignment inside the button.

public virtual String FontWeight { get; set; } #

Gets or sets the font weight of the button text.

public virtual String TextDecoration { get; set; } #

Gets or sets the text decoration style (e.g., underline).

public virtual String BorderWidth { get; set; } #

Gets or sets the width of the button border.

public virtual String BorderRadius { get; set; } #

Gets or sets the border radius.

public virtual RoundingMode RoundingMode { get; set; } #

Determines how border radius should be applied.

public Boolean FullWidth { get; set; } #

Gets or sets whether the button should be full width.

public Boolean EnableOutlookVmlFallback { get; set; } #

When enabled, renders an Outlook (MSO) VML v:roundrect fallback for rounded corners. This improves visual fidelity in classic Outlook for Windows (Word rendering engine).