DeepWorks Studios Blazor Component Library

Demo user Administrator ยท Blazor Server Library 20261206222504-6e8ff32.dirty

DwsElement

DwsElement renders a single HTML element of any tag. Unlike a plain tag it takes part in the library's permission management (it registers under its Name), honours Visible and Disabled, and exposes click and hover events.

API Reference

Basic

Without an HtmlTag the element renders as a span. Class and Style are applied to the rendered element.

Default element rendered as a span
Element rendered as a div container
Show Code
Element.razor
<DwsElement Name="ElementDemo_Element01">Default element rendered as a span</DwsElement>
<DwsElement Name="ElementDemo_Element02" HtmlTag="div" Class="mt-2 p-2" Style="height:100px;border:1px solid #888">Element rendered as a div container</DwsElement>

HTML tag

HtmlTag accepts any valid tag name; an invalid one falls back to span.

This is an article element.
Show Code
Element.razor
<DwsElement Name="ElementDemo_Element03" HtmlTag="article" ID="elementDemoArticle" Class="p-2" Style="border:1px dashed #888">
    This is an article element.
</DwsElement>

Interface-Description

Name Typ Parameters Description
Refresh void Re-renders the element.
Name Typ Default Description
HtmlTag string "span" HTML tag to render, e.g. span, div, article, section. An invalid tag name falls back to span.
ChildContent RenderFragment? null Content rendered inside the element.
Ref ElementReference? null The rendered element. Use @bind-Ref to receive it once the element exists.
StopClickPropagation bool false Stops a click on this element from bubbling to its ancestors.
KeyboardActivation bool? null null: with OnClick on a tag that is not natively interactive (span, div, ...) the element gets role="button", tabindex="0" and answers Enter and Space like a button. false: mouse-only. true: also for other tags. A role or tabindex attribute you pass wins. Avoid buttons or links inside it.
Name Typ Description
RefChanged EventCallback<ElementReference?> Raised when the element reference is captured.
OnClick EventCallback<MouseEventArgs> Raised when the element is clicked. Not raised while Disabled.
OnMouseEnter EventCallback<MouseEventArgs> Raised when the pointer enters the element. Not raised while Disabled.
OnMouseLeave EventCallback<MouseEventArgs> Raised when the pointer leaves the element, also while Disabled so hover state is always released.
Name Typ Default Description
Element ElementReference The associated web component. May be null if accessed before the component is rendered.
ComponentGuid Guid Unique identifier for the component.
TypeString string The name of the component type, obtained from reflection.
Authorized_RegisterEnabled bool false Indicates whether this component is enabled through a permission registry.
Authorized_RegisterSelected bool false Indicates whether this component is selected in permission selection mode.
GetInitializedState bool false Returns whether the component is initialized.
GetRenderModeState DwsRenderMode Returns the current render mode.
GetComponentState DwsComponentStateType Returns the current component state.
GetIsInteractiveState bool false Returns whether the component is interactive.
GetIsPrerenderingState bool false Returns whether the component is prerendering.
GetComponentLoadingState bool false Returns whether the component is loading.
IsFormBusy bool false Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState).
Name Typ Parameters Description
DebugInfo void Logs debug information about the component.
UpdateState void Updates the component's state and triggers StateHasChanged.
UpdateStateAsync Task Asynchronously updates the component's state and triggers StateHasChanged.
Dispose void Disposes the component and releases resources.
FocusAsync ValueTask bool containedInScrollableList Sets focus to the component's element.
Name Typ Default Description
Name string Required unique identifier for the component within its container.
Visible bool true Determines if the component is visible in the UI.
Disabled bool false Disables the form control, ensuring it doesn't participate in form submission.
ComponentNameSpace string The namespace for permission-based access control.
PermissionKey string? null A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins.
Class string Optional CSS class names.
Style string Optional in-line styles.
Tag object An optional user-defined object to store any additional data with the component.
BackReference DwsReference A reference to the enclosing component.
ID string The HTML ID attribute for the component.
AdditionalAttributes Dictionary<string, object> Additional HTML attributes for the component's root element.
IgnorePermissionChecks bool false Bypasses all permission checks for this component.
IgnorePermissionSelection bool false Ignore permission selection mode for this component.
IgnoreFormBusy bool false Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it.
Name Typ Description
OnInitializedCallbackStarted EventCallback Callback when OnInitialized starts.
OnInitializedCallback EventCallback Callback during OnInitialized.
OnInitializedCallbackCompleted EventCallback Callback when OnInitialized completes.
OnInitializedAsyncCallbackStarted EventCallback Callback when OnInitializedAsync starts.
OnInitializedAsyncCallback EventCallback Callback during OnInitializedAsync.
OnInitializedAsyncCallbackCompleted EventCallback Callback when OnInitializedAsync completes.
OnIsComponentLoadingChanged EventCallback<bool> Callback when IsComponentLoading changes.
OnCurrentRenderModeChanged EventCallback<DwsRenderMode> Callback when CurrentRenderMode changes.
OnComponentStateChanged EventCallback<DwsComponentStateType> Callback when ComponentState changes.
An error has occurred. This app may no longer respond until reloaded.