Sisk

Class

HtmlElement

Namespace
TinyComponents
Assembly
TinyComponents.dll

Represents an HTML element for rendering

C#
public class HtmlElement : INode

Inheritance #

object ← HtmlElement

Implements #

INode

Inherited Members #

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Extension Methods #

XmlNodeExtensions.SelfClosed<HtmlElement>(HtmlElement), XmlNodeExtensions.WithAttribute<HtmlElement>(HtmlElement, string), XmlNodeExtensions.WithAttribute<HtmlElement>(HtmlElement, string, object?), XmlNodeExtensions.WithAttributes<HtmlElement>(HtmlElement, object?), HtmlElementExtensions.WithClass<HtmlElement>(HtmlElement, params string[]), XmlNodeExtensions.WithContent<HtmlElement>(HtmlElement, Action<HtmlElement>), XmlNodeExtensions.WithContent<HtmlElement>(HtmlElement, object?), XmlNodeExtensions.WithContent<HtmlElement>(HtmlElement, string?), HtmlElementExtensions.WithId<HtmlElement>(HtmlElement, string), HtmlElementExtensions.WithName<HtmlElement>(HtmlElement, string), HtmlElementExtensions.WithStyle<HtmlElement>(HtmlElement, object)

Constructors #

NameDescription
HtmlElement()Initializes a new instance of the HtmlElement class with no container HTML element.
HtmlElement(string)Initializes a new instance of the HtmlElement class with the specified tag name.
HtmlElement(string, object?)Initializes a new instance of the HtmlElement class with the specified tag name and content.
HtmlElement(string, string?)Initializes a new instance of the HtmlElement class with the specified tag name and content.
HtmlElement(string, Action<HtmlElement>)Initializes a new instance of the HtmlElement class with the specified tag name.

Properties #

NameDescription
AttributesGets or sets the collection of HTML attributes for the element.
ChildrenGets or sets the collection of child elements within this element.
ClassListGets or sets the list of CSS classes for the HTML element. Initializes with an empty list. Use this to apply CSS class names to the element.
IdGets or sets the ID attribute of the HTML element. Used to uniquely identify the element within the page.
NameGets or sets the name attribute of the HTML element. The name is used to reference elements in JavaScript, or to reference form data after a form is submitted.
SelfClosingGets or sets a value indicating whether the element is self-closing.
StyleGets or sets the CSS style object used to render the style attribute.
TabIndexGets or sets the tab index of the HTML element.
TagNameGets or sets the tag name of the HTML element (e.g., “div”, “span”).
TooltipTitleGets or sets the tooltip text to display for the HTML element.

Methods #

NameDescription
Create(string)Creates an HtmlElement from the specified emmet template.
Create(string, object?, object?, object?[]?, bool)Creates an HtmlElement from the specified emmet template and adds the specified style, attributes, and children.
Create(string, Action<HtmlElement>)Creates an HtmlElement from the specified emmet template and configures it using the specified action.
Format(FormattableString)Formats the specified HTML string format, escaping the string interpolation pieces.
Fragment(params object?[])Creates an fragment HtmlElement with specified children.
Fragment(Action<HtmlElement>)Creates an fragment HtmlElement with specified self-action.
GetAttributes()Represents the protected method which gets the attributes to be rendered.
ToString()Renders the HTML element into a string with optional pretty formatting.

Operators #

NameDescription
operator +(HtmlElement, object?)

Type to search the documentation and the API reference.