Table of Contents

Class TwBlazorComponentBase

Namespace
TwBlazor
Assembly
TwBlazor.dll
public class TwBlazorComponentBase : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent
Inheritance
TwBlazorComponentBase
Implements
Derived
Inherited Members

Constructors

TwBlazorComponentBase()

public TwBlazorComponentBase()

Properties

AriaLabel

Gets or sets the ARIA label for accessibility.

[Parameter]
public string? AriaLabel { get; set; }

Property Value

string

Remarks

Provides a text label for assistive technologies when a visible label is not present.

AriaLabelledBy

Gets or sets the ID of another element that labels this component for accessibility.

[Parameter]
public string? AriaLabelledBy { get; set; }

Property Value

string

Remarks

References another element that serves as the label for this component.

Attributes

Gets or sets a collection of additional attributes to apply to the component.

[Parameter(CaptureUnmatchedValues = true)]
public Dictionary<string, object> Attributes { get; set; }

Property Value

Dictionary<string, object>

Remarks

This captures any unmatched HTML attributes that can be passed to the component.

Class

Gets or sets the CSS class(es) to apply to the component.

[Parameter]
public string Class { get; set; }

Property Value

string

Id

Gets or sets the unique identifier for the component.

[Parameter]
public string? Id { get; set; }

Property Value

string

Remarks

If not provided, a unique ID will be automatically generated.

Rounded

Gets or sets the border radius for the component.

[Parameter]
public Rounded? Rounded { get; set; }

Property Value

Rounded?

Remarks

If not set, uses the global default from DefaultRounded. Set to None to explicitly remove border radius.

Shadow

Gets or sets the shadow (elevation) level for the component.

[Parameter]
public Shadow? Shadow { get; set; }

Property Value

Shadow?

Remarks

If not set, uses the global default from DefaultShadow. Set to None to explicitly remove shadow.

Style

Gets or sets inline CSS styles to apply to the component.

[Parameter]
public string? Style { get; set; }

Property Value

string

colorBuilder

[Inject]
protected ColorBuilder colorBuilder { get; set; }

Property Value

ColorBuilder

effectiveRounded

Gets the effective rounded to use, considering both the parameter and global configuration.

protected Rounded effectiveRounded { get; }

Property Value

Rounded

effectiveShadow

Gets the effective shadow to use, considering both the parameter and global configuration.

protected Shadow effectiveShadow { get; }

Property Value

Shadow

hasUserProvidedId

Indicates whether an Id was explicitly provided by the consumer (true) or auto-generated by TwBlazorComponentBase (false).

protected bool hasUserProvidedId { get; }

Property Value

bool

iconColorBuilder

[Inject]
protected IconColorBuilder iconColorBuilder { get; set; }

Property Value

IconColorBuilder

options

[Inject]
protected TwBlazorOptions options { get; set; }

Property Value

TwBlazorOptions

popoverBuilder

[Inject]
protected PopoverBuilder popoverBuilder { get; set; }

Property Value

PopoverBuilder

roundedBuilder

[Inject]
protected RoundedBuilder roundedBuilder { get; set; }

Property Value

RoundedBuilder

shadowBuilder

[Inject]
protected ShadowBuilder shadowBuilder { get; set; }

Property Value

ShadowBuilder

Methods

OnParametersSet()

Invoked when the component's parameters have been set. Ensures that the component has a unique identifier by generating one if none is provided.

protected override void OnParametersSet()

Remarks

If the component's identifier is not set, a unique ID is generated based on the component's type name (with a 'Tw' prefix removed if present) and a GUID. This helps ensure that each component instance can be uniquely identified, which is useful for scenarios such as associating labels with form elements or targeting elements in client-side scripts.