Class HtmlElement
- Namespace
- TinyComponents
- Assembly
- TinyComponents.dll
Represents an HTML element for rendering
public class HtmlElement : INode
- Inheritance
-
HtmlElement
- Implements
- Inherited Members
- Extension Methods
Constructors
- 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, Action<HtmlElement>)
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.
Properties
- Attributes
Gets or sets the collection of HTML attributes for the element.
- Children
Gets or sets the collection of child elements within this element.
- ClassList
Gets 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.
- Id
Gets or sets the ID attribute of the HTML element. Used to uniquely identify the element within the page.
- Name
Gets 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.
- SelfClosing
Gets or sets a value indicating whether the element is self-closing.
- Style
Gets or sets the CSS style object used to render the style attribute.
- TabIndex
Gets or sets the tab index of the HTML element.
- TagName
Gets or sets the tag name of the HTML element (e.g., "div", "span").
- TooltipTitle
Gets or sets the tooltip text to display for the HTML element.
Methods
- Create(string)
Creates an HtmlElement from the specified emmet template.
- Create(string, Action<HtmlElement>)
Creates an HtmlElement from the specified emmet template and configures it using the specified action.
- Create(string, object?, object?, object?[]?, bool)
Creates an HtmlElement from the specified emmet template and adds the specified style, attributes, and children.
- Format(FormattableString)
Formats the specified HTML string format, escaping the string interpolation pieces.
- Fragment(Action<HtmlElement>)
Creates an fragment HtmlElement with specified self-action.
- Fragment(params object?[])
Creates an fragment HtmlElement with specified children.
- GetAttributes()
Represents the protected method which gets the attributes to be rendered.
- ToString()
Renders the HTML element into a string with optional pretty formatting.