using Microsoft.AspNetCore.Components; namespace Connected.Components; public abstract class UIComponent : ComponentBase { /// /// User class names, separated by space. /// [Parameter] public string Class { get; set; } /// /// User styles, applied on top of the component's own classes and styles. /// [Parameter] public string Style { get; set; } /// /// Use Tag to attach any user data object to the component for your convenience. /// [Parameter] public object Tag { get; set; } /// /// UserAttributes carries all attributes you add to the component that don't match any of its parameters. /// They will be splatted onto the underlying HTML tag. /// [Parameter(CaptureUnmatchedValues = true)] public Dictionary UserAttributes { get; set; } = new(); /// /// If the UserAttributes contain an ID make it accessible for WCAG labelling of input fields /// public string FieldId => UserAttributes.TryGetValue("id", out var id) ? id.ToString() : $"input-{Guid.NewGuid()}"; }