HtmlForgeX

API Reference

Class

Document

Namespace HtmlForgeX
Assembly HtmlForgeX
Base Element
Implements
IDisposable

Represents an HTML document.

Inheritance

Constructors

public Document(Nullable<LibraryMode> librariesMode = null) #

Initializes a new instance of the Document class.

Parameters

librariesMode System.Nullable{HtmlForgeX.LibraryMode} = null optionalposition: 0
Initial library mode.

Methods

AddLibrary 3 overloads
public Boolean AddLibrary(Library library) #
Returns: Boolean

Adds a predefined library.

Parameters

library HtmlForgeX.Libraries requiredposition: 0
Library identifier.
public Void AddLibrary(Libraries library, Byte weight) #
Returns: Void

Adds a predefined library with a custom load order weight.

Parameters

library HtmlForgeX.Libraries requiredposition: 0
Library identifier.
weight System.Byte requiredposition: 1
Ordering weight. Lower values load first.
AddLibrary(HtmlForgeX.Library library) #

Adds a custom library definition.

Parameters

library HtmlForgeX.Library required
Library to add.

Returns

true if the library was added successfully; otherwise false.

Dispose 2 overloads
public virtual Void Dispose() #
Returns: Void

Releases resources used by the Document.

Dispose(System.Boolean disposing) #

Disposes managed and unmanaged resources.

Parameters

disposing System.Boolean required
Whether managed resources should be disposed.
Finalize() #

Finalizer to ensure resources are released.

FinalRegistrationPass() #

Final registration pass to ensure all elements with Document references register their libraries

FinalRegistrationPassForElement(HtmlForgeX.Element element) #

Recursively forces library registration for all elements in the tree

Parameters

element HtmlForgeX.Element required
The element to process.
RegisterAllLibraries() #

Recursively registers libraries from all elements in the document.

RegisterLibraries() #
RegisterLibrariesFromElement(HtmlForgeX.Element element) #

Recursively registers libraries from an element and all its children.

Parameters

element HtmlForgeX.Element required
The element to process.
public Void Save(String path, Boolean openInBrowser = false, String scriptPath = null, String stylePath = null) #
Returns: Void

Saves the document to disk.

Parameters

path System.String requiredposition: 0
File path.
openInBrowser System.Boolean = false optionalposition: 1
Whether to open the file after saving.
scriptPath System.String = null optionalposition: 2
Optional scripts path.
stylePath System.String = null optionalposition: 3
Optional styles path.
public async Task SaveAsync(String path, Boolean openInBrowser = false, String scriptPath = null, String stylePath = null, CancellationToken cancellationToken = null) #
Returns: Task

Saves the document to disk asynchronously.

Parameters

path System.String requiredposition: 0
File path.
openInBrowser System.Boolean = false optionalposition: 1
Whether to open the file after saving.
scriptPath System.String = null optionalposition: 2
Optional scripts path.
stylePath System.String = null optionalposition: 3
Optional styles path.
cancellationToken System.Threading.CancellationToken = null optionalposition: 4
Token used to cancel the operation.
public Document SetSmartTabCssVar(String name, String value) #
Returns: Document

Sets a document-wide SmartTab CSS variable (e.g., "--st-anchor-active-primary-color").

Parameters

name System.String requiredposition: 0
value System.String requiredposition: 1
public Document SetSmartTabThemeColors(String activePrimary = null, String activeSecondary = null, String defaultPrimary = null, String defaultSecondary = null, String borderColor = null, String background = null) #
Returns: Document

Convenience to set common SmartTab theme colors globally.

Parameters

activePrimary System.String = null optionalposition: 0
activeSecondary System.String = null optionalposition: 1
defaultPrimary System.String = null optionalposition: 2
defaultSecondary System.String = null optionalposition: 3
borderColor System.String = null optionalposition: 4
background System.String = null optionalposition: 5
public Document Settings(Action<DocumentSettings> configure) #
Returns: Document

Opens a settings scope for this document to configure advanced behaviors.

Parameters

configure System.Action{HtmlForgeX.DocumentSettings} requiredposition: 0
public override String ToString() #
Returns: String

Returns the complete HTML representation of this document.

Returns

Complete HTML document as a string.

public Document WithSurfaceAccentColor(TablerColor color) #
Returns: Document

Sets the document-wide accent color used by surfaced shells and inheriting dashboard primitives.

Parameters

color HtmlForgeX.TablerColor requiredposition: 0
public Document WithSurfaceAccentIntensity(TablerSurfaceAccentIntensity intensity) #
Returns: Document

Sets the document-wide surface accent intensity for surfaced shells.

Parameters

intensity HtmlForgeX.TablerSurfaceAccentIntensity requiredposition: 0
public Document WithSurfaceDensity(TablerSurfaceDensity density) #
Returns: Document

Sets the document-wide surface density for surfaced shells.

Parameters

density HtmlForgeX.TablerSurfaceDensity requiredposition: 0
public Document WithSurfaceRadius(TablerSurfaceRadius radius) #
Returns: Document

Sets the document-wide surface radius for surfaced shells.

Parameters

radius HtmlForgeX.TablerSurfaceRadius requiredposition: 0
public Document WithSurfaceStyle(TablerSurfaceStyle style) #
Returns: Document

Sets a document-wide surface style shared by cards, headers, sidebars, and menus.

Parameters

style HtmlForgeX.TablerSurfaceStyle requiredposition: 0

Properties

public DocumentConfiguration Configuration { get; } #

Configuration and state for this document instance.

public Head Head { get; } #

Gets the Head element of this document.

public Body Body { get; } #

Gets the Body element of this document.

public LibraryMode LibraryMode { get; set; } #

Gets or sets how external libraries are loaded.

public ThemeMode ThemeMode { get; set; } #

Gets or sets the initial theme mode.

public HfxThemeVariant LightThemeVariant { get; set; } #

Gets or sets the default light theme variant used when ThemeMode resolves to light.

public HfxThemeVariant DarkThemeVariant { get; set; } #

Gets or sets the default dark theme variant used when ThemeMode resolves to dark.

public HfxThemeAccessibility ThemeAccessibility { get; set; } #

Gets or sets accessibility overrides for contrast/palette adjustments.

public String Language { get; set; } #

Gets or sets the language for the root <html> element (default: "en"). Set to null/empty to omit the attribute.

public Boolean AutoStackColumns { get; set; } #

Controls whether columns automatically stack their direct children using Bootstrap vstack. Default is true.

public Boolean AutoStackPages { get; set; } #

Controls whether pages that render children directly (without rows) are wrapped in a vstack with a gap. Default is true.

public TablerSpacing DefaultStackGap { get; set; } #

Sets the default gap scale used for automatic stacks (columns/pages). Maps to Bootstrap's gap-* utilities; typical values 0..5.

public TablerSpacing InnerStackGap { get; set; } #

Sets the default inner gap scale used for closely related items within a block (e.g., header→content). Components may rely on this to avoid overly loose internal spacing while keeping inter-block rhythm.

public Boolean EnableTextBlockSpacing { get; set; } #

Enables a default bottom margin on Tabler text blocks to keep paragraphs comfortably spaced without specifying mb-* everywhere. Default: true.

public TablerSpacing TextBlockSpacing { get; set; } #

Sets the default text block spacing scale used when EnableTextBlockSpacing is enabled. Maps to mb-*.

public String Path { get; set; } #

Gets or sets the output path used when saving the document.

public String StylePath { get; set; } #

Gets or sets the default style output path.

public String ScriptPath { get; set; } #

Gets or sets the default script output path.