HtmlForgeX

API Reference

Class

EmailLink

Namespace HtmlForgeX.Email
Assembly HtmlForgeX.Email
Base Element
Implements
ILayoutAware ITextElement<EmailLink>

Represents a link element for email layouts with email-safe styling and attributes. Provides clickable text links with customizable fonts, colors, and text formatting.

Inheritance

Constructors

EmailLink 3 overloads
public EmailLink() #

Initializes a new instance of the EmailLink class.

public EmailLink(String content, String href) #

Initializes a new instance of the EmailLink class with content and URL.

Parameters

content System.String requiredposition: 0
The link text content.
href System.String requiredposition: 1
The link URL.
public EmailLink(String content, String href, Boolean openInNewWindow) #

Initializes a new instance of the EmailLink class with content, URL, and new window setting.

Parameters

content System.String requiredposition: 0
The link text content.
href System.String requiredposition: 1
The link URL.
openInNewWindow System.Boolean requiredposition: 2
Whether to open in a new window.

Methods

public String GetThemeColor() #
Returns: String

Gets the appropriate link color based on theme mode.

public String GetThemeHoverColor() #
Returns: String

Gets the appropriate hover color based on theme mode.

IsInEmailColumn() #

Checks if this EmailLink is being rendered inside an EmailColumn.

Returns

True if inside an EmailColumn, false otherwise.

public override String ToString() #
Returns: String

Converts the EmailLink to its HTML representation.

Returns

HTML string representing the email link.

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

Sets the text alignment.

Parameters

alignment HtmlForgeX.Email.Alignment requiredposition: 0
The alignment option.

Returns

The EmailLink instance.

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

Sets the link color.

Parameters

color System.String requiredposition: 0
The link color.

Returns

The EmailLink object, allowing for method chaining.

WithColor(HtmlForgeX.Email.RGBColor color) #

Sets the link color using RGBColor.

Parameters

color HtmlForgeX.Email.RGBColor required
The link color.

Returns

The EmailLink object, allowing for method chaining.

public EmailLink WithContent(String content) #
Returns: EmailLink

Sets the link text content.

Parameters

content System.String requiredposition: 0
The link text content.

Returns

The EmailLink object, allowing for method chaining.

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

Sets the font family.

Parameters

fontFamily System.String requiredposition: 0
The font family.

Returns

The EmailLink object, allowing for method chaining.

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

Sets the font size.

Parameters

fontSize System.String requiredposition: 0
The font size.

Returns

The EmailLink object, allowing for method chaining.

WithFontSize(HtmlForgeX.Email.EmailFontSize fontSize) #

Sets the font size using predefined values.

Parameters

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

Returns

The EmailLink object, allowing for method chaining.

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

Sets the font weight.

Parameters

fontWeight System.String requiredposition: 0
The font weight.

Returns

The EmailLink object, allowing for method chaining.

WithFontWeight(HtmlForgeX.Email.FontWeight fontWeight) #

Sets the font weight using predefined values.

Parameters

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

Returns

The EmailLink object, allowing for method chaining.

public EmailLink WithHoverColor(String hoverColor) #
Returns: EmailLink

Sets the hover color for the link.

Parameters

hoverColor System.String requiredposition: 0
The hover color.

Returns

The EmailLink object, allowing for method chaining.

public EmailLink WithHref(String href) #
Returns: EmailLink

Sets the link URL.

Parameters

href System.String requiredposition: 0
The link URL.

Returns

The EmailLink object, allowing for method chaining.

public EmailLink WithInlineStyle(String style) #
Returns: EmailLink

Adds custom inline styles.

Parameters

style System.String requiredposition: 0
The inline style to add.

Returns

The EmailLink object, allowing for method chaining.

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

Sets the line height.

Parameters

lineHeight System.String requiredposition: 0
The line height.

Returns

The EmailLink object, allowing for method chaining.

WithMargin 3 overloads
WithMargin(HtmlForgeX.Email.EmailSpacing spacing) #

Sets the margin using predefined spacing values.

Parameters

spacing HtmlForgeX.Email.EmailSpacing required
The predefined spacing value for all sides.

Returns

The EmailLink object, allowing for method chaining.

public EmailLink WithMargin(EmailSpacing vertical, EmailSpacing horizontal) #
Returns: EmailLink

Sets the margin using predefined spacing values for vertical and horizontal.

Parameters

vertical HtmlForgeX.Email.EmailSpacing requiredposition: 0
The predefined vertical spacing (top and bottom).
horizontal HtmlForgeX.Email.EmailSpacing requiredposition: 1
The predefined horizontal spacing (left and right).

Returns

The EmailLink object, allowing for method chaining.

public EmailLink WithMargin(EmailSpacing top, EmailSpacing right, EmailSpacing bottom, EmailSpacing left) #
Returns: EmailLink

Sets the margin using predefined spacing values for all sides.

Parameters

top HtmlForgeX.Email.EmailSpacing requiredposition: 0
The predefined top spacing.
right HtmlForgeX.Email.EmailSpacing requiredposition: 1
The predefined right spacing.
bottom HtmlForgeX.Email.EmailSpacing requiredposition: 2
The predefined bottom spacing.
left HtmlForgeX.Email.EmailSpacing requiredposition: 3
The predefined left spacing.

Returns

The EmailLink object, allowing for method chaining.

public EmailLink WithNewWindow(Boolean openInNewWindow = true) #
Returns: EmailLink

Sets whether the link should open in a new window.

Parameters

openInNewWindow System.Boolean = true optionalposition: 0
Whether to open in a new window.

Returns

The EmailLink object, allowing for method chaining.

public EmailLink WithoutUnderlineOnHover() #
Returns: EmailLink

Disables underline on hover.

Returns

The EmailLink object, allowing for method chaining.

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

Sets the text decoration.

Parameters

textDecoration System.String requiredposition: 0
The text decoration.

Returns

The EmailLink object, allowing for method chaining.

WithTextDecoration(HtmlForgeX.Email.TextDecoration decoration) #

Sets the text decoration using predefined options.

Parameters

decoration HtmlForgeX.Email.TextDecoration required
The decoration option.

Returns

The EmailLink instance.

public EmailLink WithTitle(String title) #
Returns: EmailLink

Sets the link title (tooltip text).

Parameters

title System.String requiredposition: 0
The title text.

Returns

The EmailLink object, allowing for method chaining.

public EmailLink WithUnderlineOnHover() #
Returns: EmailLink

Enables underline on hover.

Returns

The EmailLink object, allowing for method chaining.

Properties

public String Content { get; set; } #

Gets or sets the link text content.

public String Href { get; set; } #

Gets or sets the link URL.

public virtual String FontFamily { get; set; } #

Gets or sets the font family.

public virtual String FontSize { get; set; } #

Gets or sets the font size.

public virtual String LineHeight { get; set; } #

Gets or sets the line height.

public virtual String Color { get; set; } #

Gets or sets the link color.

public virtual String TextAlign { get; set; } #

Gets or sets the text alignment.

public virtual String FontWeight { get; set; } #

Gets or sets the font weight.

public virtual String TextDecoration { get; set; } #

Gets or sets the text decoration.

public Boolean OpenInNewWindow { get; set; } #

Gets or sets whether the link should open in a new window.

public String Title { get; set; } #

Gets or sets the link title (tooltip text).

public String InlineStyle { get; set; } #

Gets or sets additional inline styles.

public String HoverColor { get; set; } #

Gets or sets the hover color for the link.

public Boolean UnderlineOnHover { get; set; } #

Gets or sets whether to underline the link on hover.