# HtmlElementProperties class
{: .no_toc }

The dynamic property bag on an [**HtmlElement**](/tB/Packages/tbIDE/HtmlElement.md). Reached through [**HtmlElement.Properties**](/tB/Packages/tbIDE/HtmlElement.md#properties). Every CSS property, every DOM attribute, every custom-widget extension is accessed through this bag --- and almost always written in shorthand because [**Properties**](/tB/Packages/tbIDE/HtmlElement.md#properties) is the **DefaultMember** of [**HtmlElement**](/tB/Packages/tbIDE/HtmlElement.md):

```tb inert=external
With element                          ' element.Properties is the default member
    .style.display    = "flex"        ' Properties.Item("style").Item("display").Value = "flex"
    .style.flexDirection = "column"
    .style.gap        = "10px"
    .innerText        = "Hello"
End With
```

The shorthand reads at run time as a chain of `Item("name")` lookups against the underlying DOM element --- see [Dynamic DOM property resolution](/tB/Packages/tbIDE/index.md#dynamic-dom-property-resolution) on the package overview.

> [!IMPORTANT]
> This interface is **`[COMExtensible(True)]`**. Property names are resolved against the live DOM element at run time, not declared statically on the interface. The compiler does not validate names --- a typo (`.innerTxt = "..."` instead of `.innerText = "..."`) fails silently or throws at run time. The accepted set is **every DOM property of the underlying tag**, plus any custom-widget extensions; the reference does not enumerate it.

> [!NOTE] BETA 1045
> A property whose name starts with `on` is ignored. `.onclick = "..."` sets nothing, and the call returns without an error. Register a listener with [**HtmlElement.AddEventListener**](/tB/Packages/tbIDE/HtmlElement.md#addeventlistener) instead.

> [!IMPORTANT]
> Text set as `innerHTML` is parsed as HTML, and an inline event handler in it runs as script of the IDE's own page, with access to everything that page's script can reach. An `<img>` whose image fails to load runs its `onerror` handler as soon as it is set, with nothing clicked. Escape any text that comes from a file, a project or the user before it goes into `innerHTML`, or set `innerText` instead.

## Default member

The interface's **DefaultMember** is [**Item**](#item) --- so `properties("style")` is equivalent to `properties.Item("style")`. Chains of `.style.color = "red"` thus desugar to `properties.Item("style").Item("color").Value = "red"`.

## Properties

### Item
{: .no_toc }

Looks up a property by name. Returns an [**HtmlElementProperty**](/tB/Packages/tbIDE/HtmlElementProperty.md), which includes the property's value plus a nested [**Properties**](/tB/Packages/tbIDE/HtmlElementProperty.md#properties) for further drill-down.

Syntax: *properties*( *DomPropertyName* ) **As** [**HtmlElementProperty**](/tB/Packages/tbIDE/HtmlElementProperty.md)

*DomPropertyName*
: *required* The property name. **String**. Standard DOM property names, CSS-style property names (when looked up under `style`), or custom-widget property names --- all forwarded to the IDE's tool-window renderer.
