@typeparam TValue @inherits DInputBase @attribute [CascadingTypeParameter(nameof(TValue))] @* daisyUI Radio: https://daisyui.com/components/radio/ . The group holds the bound value and cascades itself (not fixed, so every DRadio re-renders with it); its radios share one name, the name attribute or a per-instance id. It adds a div role="radiogroup" only when given attributes (a class, an aria-label). *@ @if (AdditionalAttributes is null || AdditionalAttributes.Count == 0) { @ChildContent } else {
@ChildContent
}
@code { [Parameter] public RenderFragment ChildContent { get; set; } readonly string uid = "d" + Guid.NewGuid().ToString("N")[..8]; internal string GroupName => string.IsNullOrEmpty(NameAttributeValue) ? uid : NameAttributeValue; internal bool GroupInvalid => IsInvalid; internal bool IsSelected(TValue value) => EqualityComparer.Default.Equals(CurrentValue, value); internal void Select(TValue value) => CurrentValue = value; }