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
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
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
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
Id
Gets or sets the unique identifier for the component.
[Parameter]
public string? Id { get; set; }
Property Value
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
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
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
cascadedDirection
Gets or sets the direction supplied by an enclosing TwDirectionProvider, if there is one.
[CascadingParameter]
protected TextDirection? cascadedDirection { get; set; }
Property Value
colorBuilder
[Inject]
protected ColorBuilder colorBuilder { get; set; }
Property Value
effectiveDirection
Gets the direction the component is laid out in: the enclosing TwDirectionProvider's when there is one, otherwise the localizer's.
protected TextDirection effectiveDirection { get; }
Property Value
effectiveInsetRounded
Gets the rounding for a control inside a rounded bar of this component: one step tighter than effectiveRounded, see Inset(Rounded).
protected Rounded effectiveInsetRounded { get; }
Property Value
effectiveRounded
Gets the effective rounded to use, considering both the parameter and global configuration.
protected Rounded effectiveRounded { get; }
Property Value
effectiveShadow
Gets the effective shadow to use, considering both the parameter and global configuration.
protected Shadow effectiveShadow { get; }
Property Value
effectiveSurfaceRounded
Gets the effective rounded for a surface such as a card, table or panel: the same as effectiveRounded, but with Full capped at Lg.
protected Rounded effectiveSurfaceRounded { get; }
Property Value
hasUserProvidedId
Indicates whether an Id was explicitly provided by the consumer (true) or auto-generated by TwBlazorComponentBase (false).
protected bool hasUserProvidedId { get; }
Property Value
iconColorBuilder
[Inject]
protected IconColorBuilder iconColorBuilder { get; set; }
Property Value
isRightToLeft
Gets whether the component is laid out right to left, in which case the Left and Right arrow keys swap roles.
protected bool isRightToLeft { get; }
Property Value
localizer
[Inject]
protected ITwLocalizer localizer { get; set; }
Property Value
options
[Inject]
protected TwBlazorOptions options { get; set; }
Property Value
popoverBuilder
[Inject]
protected PopoverBuilder popoverBuilder { get; set; }
Property Value
roundedBuilder
[Inject]
protected RoundedBuilder roundedBuilder { get; set; }
Property Value
shadowBuilder
[Inject]
protected ShadowBuilder shadowBuilder { get; set; }
Property Value
Methods
DirectionalIcon(Icon, Icon)
Picks between an icon and its mirror image, so an arrow or chevron keeps pointing the way its action goes.
protected Icon DirectionalIcon(Icon leftToRight, Icon rightToLeft)
Parameters
leftToRightIconThe icon for a left to right layout.
rightToLeftIconThe icon for a right to left layout.
Returns
- Icon
The icon for the direction the component is laid out in.
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.
ToLogicalKey(string)
Translates a pressed key into the one it stands for in a left to right layout, so a handler can treat
ArrowRight as "forwards" and ArrowLeft as "backwards" whichever way the component is laid out.
protected string ToLogicalKey(string key)
Parameters
keystringThe key reported by the keyboard event.
Returns
- string
key, with the Left and Right arrows swapped when the layout is right to left.