HxDynamicElement #

Renders an element with the specified name, attributes and child-content.

Allows dynamic composition of more complex components. Used in some of the Hx-components internally, but also exposed for your needs.

Basic usage #

Any content
<HxDynamicElement
    ElementName="@elementName" 
    class="fs-5 my-2 py-2">
        Any content <HxIcon Icon="BootstrapIcon.Trash" />
</HxDynamicElement>

<HxSelect Data="elementNames" @bind-Value="elementName" TItem="string" TValue="string" Nullable="false" />

@code
{
    private string elementName = "b";
    private string[] elementNames = { "a", "b", "button", "div", "i", "span", "strong" };
}

API #

Parameters #

Name Type Description
AdditionalAttributes IDictionary<string, object> A collection of additional attributes that will be applied to the created element.
ChildContent RenderFragment Content of the component.
ElementName string Gets or sets the name of the element to render.
ElementRef ElementReference Element reference.
ElementRefChanged Action<ElementReference> Action (synchronnous, not an EventCallback) called when the element's reference got captured.
OnClick EventCallback<MouseEventArgs> Raised after the element is clicked.
OnClickPreventDefault bool Prevents the default action for the onclick event. Deafult is false.
OnClickStopPropagation bool Stop onClick-event propagation. Deafult is false.
An unhandled error has occurred. Reload 🗙