Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,54 @@
@typeparam TItem
@typeparam TValue

@* The invalid state belongs to the choice as a whole, not to the option that happens to be focused,
so the group carries the aria-invalid too and not only the individual radio inputs of the base class. *@
<div @ref="RootElement" @attributes="HtmlAttributes"
id="@_Id"
role="radiogroup"
style="@StyleBuilder.Value"
class="@ClassBuilder.Value"
dir="@Dir?.ToString().ToLower()"
aria-label="@AriaLabel"
aria-labelledby="@GetAriaLabelledBy()">
aria-labelledby="@GetAriaLabelledBy()"
aria-describedby="@GetAriaDescribedBy()"
aria-required="@(Required ? "true" : null)"
aria-invalid="@(ValueInvalid is true ? "true" : null)"
aria-readonly="@(ReadOnly ? "true" : null)"
aria-disabled="@(IsEnabled ? null : "true")"
aria-orientation="@(Horizontal ? "horizontal" : "vertical")">

<label id="@_labelId"
disabled="@(IsEnabled is false)"
style="@Styles?.LabelContainer"
class="@Classes?.LabelContainer">
@if (LabelTemplate is not null)
{
@LabelTemplate
}
else if (Label.HasValue())
{
<span style="@Styles?.Label" class="bit-chg-lbl @Classes?.Label">@Label</span>
}
</label>
@if (HasLabel)
{
<label id="@_labelId"
style="@Styles?.LabelContainer"
class="@Classes?.LabelContainer">
@if (LabelTemplate is not null)
{
@LabelTemplate
}
else
{
<span style="@Styles?.Label" class="bit-chg-lbl @Classes?.Label">@Label</span>
}
</label>
}

@if (HasDescription)
{
<div id="@_descriptionId"
style="@Styles?.Description"
class="bit-chg-gds @Classes?.Description">
@if (DescriptionTemplate is not null)
{
@DescriptionTemplate
}
else
{
@Description
}
</div>
}

<div id="@_optionsContainerId" style="@Styles?.Container" class="bit-chg-cnt @Classes?.Container">
@if (Options is not null || ChildContent is not null)
Expand Down
Loading
Loading