HtmlForgeX

API Reference

Class

VisNetworkLabelBuilder

Namespace HtmlForgeX
Assembly HtmlForgeX

Provides a fluent API for building HTML-formatted labels for VisNetwork nodes and edges. IMPORTANT: VisJS has limited native HTML support. Only the following tags work natively: - <b> for bold text - <i> for italic text - <code> for monospace text - \n for line breaks (recommended over <br>) Other HTML tags like <u>, <span>, <div>, <small> etc. are NOT supported by VisJS. They will be rendered as plain text. For full HTML support, consider using the visjs-html-nodes plugin (https://github.com/NickvanDyke/visjs-html-nodes).

Inheritance

  • Object
  • VisNetworkLabelBuilder

Constructors

public VisNetworkLabelBuilder() #

Initializes a new instance of the VisNetworkLabelBuilder class.

Methods

public VisNetworkLabelBuilder Bold(String text) #
Returns: VisNetworkLabelBuilder

Adds bold text to the label.

Parameters

text System.String requiredposition: 0
The text to make bold

Returns

The label builder for method chaining

public String Build() #
Returns: String

Builds the final HTML label string.

Returns

The HTML-formatted label

public VisNetworkLabelBuilder BulletPoint(String text) #
Returns: VisNetworkLabelBuilder

Creates a simple bulleted list item using supported HTML. Uses "• " prefix since <ul>/<li> are not supported.

Parameters

text System.String requiredposition: 0
The list item text

Returns

The label builder for method chaining

public VisNetworkLabelBuilder Code(String text) #
Returns: VisNetworkLabelBuilder

Adds code/monospace text to the label. This is one of the few HTML tags natively supported by VisJS.

Parameters

text System.String requiredposition: 0
The text to display in monospace font

Returns

The label builder for method chaining

public VisNetworkLabelBuilder Italic(String text) #
Returns: VisNetworkLabelBuilder

Adds italic text to the label.

Parameters

text System.String requiredposition: 0
The text to make italic

Returns

The label builder for method chaining

public VisNetworkLabelBuilder LabelValue(String label, String value) #
Returns: VisNetworkLabelBuilder

Creates a multi-format line with bold label and regular value. Useful for key-value pairs like "Status: Active".

Parameters

label System.String requiredposition: 0
The label text (will be bold)
value System.String requiredposition: 1
The value text

Returns

The label builder for method chaining

public VisNetworkLabelBuilder LineBreak() #
Returns: VisNetworkLabelBuilder

Adds a line break to the label. Uses \n for line breaks as recommended by VisJS documentation.

Returns

The label builder for method chaining

op_Implicit(HtmlForgeX.VisNetworkLabelBuilder builder) #

Implicitly converts the builder to a string.

Parameters

builder HtmlForgeX.VisNetworkLabelBuilder required
The label builder
public VisNetworkLabelBuilder Text(String text) #
Returns: VisNetworkLabelBuilder

Adds plain text to the label.

Parameters

text System.String requiredposition: 0
The text to add

Returns

The label builder for method chaining