HtmlForgeX

API Reference

Class

Span

Namespace HtmlForgeX
Assembly HtmlForgeX
Base Element

Represents a <span> element with configurable styling options. The Span class exposes helper methods for applying common CSS attributes without manually managing the underlying style collection.

Inheritance

Constructors

public Span(Span parent = null) #

Initializes a new instance of the Span class.

Parameters

parent HtmlForgeX.Span = null optionalposition: 0
Optional parent span used when building chained content.

Methods

public Span AddColoredText(String text, RGBColor color) #
Returns: Span

Adds colored text to the parent. This creates a new span for the text and returns the parent span for chaining.

Parameters

text System.String requiredposition: 0
The text content.
color HtmlForgeX.RGBColor requiredposition: 1
The text color.

Returns

The parent span for method chaining.

public virtual Span AddContent(String content) #
Returns: Span

Adds content as a child of the current span and returns a wrapper for styling.

Parameters

content System.String requiredposition: 0
The text to add as a new Span.

Returns

A wrapper span used for method chaining.

public Span AddStyledText(String text, RGBColor color = null, String fontSize = null, Nullable<FontWeight> fontWeight = null) #
Returns: Span

Adds styled text to the parent. This creates a new span for the text and returns the parent span for chaining.

Parameters

text System.String requiredposition: 0
The text content.
color HtmlForgeX.RGBColor = null optionalposition: 1
Optional text color.
fontSize System.String = null optionalposition: 2
Optional font size.
fontWeight System.Nullable{HtmlForgeX.FontWeight} = null optionalposition: 3
Optional font weight.

Returns

The parent span for method chaining.

public virtual Span AppendContent(String content) #
Returns: Span

Appends new content to the current span while keeping styling in the parent chain.

Parameters

content System.String requiredposition: 0
Text or HTML to append.

Returns

Wrapper span allowing further configuration.

public String GenerateClasses() #
Returns: String

Builds the CSS class string based on assigned Tabler properties.

Returns

Combined CSS class string.

public String GenerateStyle() #
Returns: String

Builds the style attribute string based on assigned properties.

Returns

Combined CSS style string.

public override String ToString() #
Returns: String

Renders the span as an HTML string including any chained spans.

Returns

HTML markup representing the span.

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

Sets the text alignment.

Parameters

alignment HtmlForgeX.Alignment requiredposition: 0
Alignment value.

Returns

The current span instance.

public virtual Span WithBackgroundColor(RGBColor backgroundColor) #
Returns: Span

Sets the background color for the span.

Parameters

backgroundColor HtmlForgeX.RGBColor requiredposition: 0
Color to assign.

Returns

The current span instance.

WithColor 2 overloads
public virtual Span WithColor(TablerColor color) #
Returns: Span

Sets the text color for the span.

Parameters

color HtmlForgeX.RGBColor requiredposition: 0
Color to assign.

Returns

The current span instance.

WithColor(HtmlForgeX.TablerColor color) #

Sets the Tabler color class for the span.

Parameters

color HtmlForgeX.TablerColor required
Tabler color value.

Returns

The current span instance.

public virtual Span WithDirection(Direction direction) #
Returns: Span

Sets the text direction.

Parameters

direction HtmlForgeX.Direction requiredposition: 0
Direction value.

Returns

The current span instance.

public virtual Span WithDisplay(Display display) #
Returns: Span

Sets the display style of the span.

Parameters

display HtmlForgeX.Display requiredposition: 0
Display value.

Returns

The current span instance.

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

Sets the font family.

Parameters

fontFamily System.String requiredposition: 0
Font family name.

Returns

The current span instance.

public virtual Span WithFontSize(String fontSize) #
Returns: Span

Sets the CSS font-size value.

Parameters

fontSize System.String requiredposition: 0
Font size string.

Returns

The current span instance.

public virtual Span WithFontStyle(FontStyle fontStyle) #
Returns: Span

Sets the font style.

Parameters

fontStyle HtmlForgeX.FontStyle requiredposition: 0
Style value.

Returns

The current span instance.

public virtual Span WithFontVariant(FontVariant fontVariant) #
Returns: Span

Sets the font variant.

Parameters

fontVariant HtmlForgeX.FontVariant requiredposition: 0
Variant value.

Returns

The current span instance.

WithFontWeight 2 overloads
public virtual Span WithFontWeight(TablerFontWeight weight) #
Returns: Span

Sets the font weight.

Parameters

fontWeight HtmlForgeX.FontWeight requiredposition: 0
Weight value.

Returns

The current span instance.

WithFontWeight(HtmlForgeX.TablerFontWeight weight) #

Sets the Tabler font weight for the span.

Parameters

weight HtmlForgeX.TablerFontWeight required
Tabler font weight value.

Returns

The current span instance.

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

Sets the CSS line-height value.

Parameters

lineHeight System.String requiredposition: 0
Line height string.

Returns

The current span instance.

public virtual Span WithOpacity(Nullable<Double> opacity) #
Returns: Span

Sets the opacity of the span.

Parameters

opacity System.Nullable{System.Double} requiredposition: 0
Opacity value.

Returns

The current span instance.

public virtual Span WithTextDecoration(TextDecoration textDecoration) #
Returns: Span

Sets the text decoration.

Parameters

textDecoration HtmlForgeX.TextDecoration requiredposition: 0
Decoration value.

Returns

The current span instance.

public virtual Span WithTextTransform(TextTransform textTransform) #
Returns: Span

Sets the text transform property.

Parameters

textTransform HtmlForgeX.TextTransform requiredposition: 0
Transform value.

Returns

The current span instance.

Properties

public String Content { get; set; } #

Content of the span element.

public RGBColor Color { get; set; } #

Text color.

public RGBColor BackGroundColor { get; set; } #

Background color.

public String FontSize { get; set; } #

CSS font-size value.

public String LineHeight { get; set; } #

CSS line-height value.

public Nullable<FontWeight> FontWeight { get; set; } #

Font weight.

public Nullable<FontStyle> FontStyle { get; set; } #

Font style.

public Nullable<FontVariant> FontVariant { get; set; } #

Font variant.

public String FontFamily { get; set; } #

Font family name.

public Nullable<Alignment> Alignment { get; set; } #

Text alignment.

public Nullable<TextDecoration> TextDecoration { get; set; } #

Text decoration.

public Nullable<TextTransform> TextTransform { get; set; } #

Text transform.

public Nullable<Direction> Direction { get; set; } #

Text direction.

public Nullable<Display> Display { get; set; } #

Display style.

public Nullable<Double> Opacity { get; set; } #

Opacity value.

public Nullable<TablerColor> TablerColor { get; set; } #

Tabler color class.

public Nullable<TablerFontWeight> TablerFontWeight { get; set; } #

Tabler font weight.

public List<Span> HtmlSpans { get; } #

Collection of child Span elements created through content operations.