0

Is there a way to disable InputRadioGroup in blazor webassembly?

I tried <InputRadioGroup Disabled="false">, but that is obviously not working. Any other way?

mko
  • 6,638
  • 12
  • 67
  • 118
  • Does this answer your question? [How to enable/disable inputs in blazor](https://stackoverflow.com/questions/55002514/how-to-enable-disable-inputs-in-blazor) – Ahmed Sbai Jan 23 '23 at 14:33
  • @AhmedSbai Definitely not a duplicate of this: `InputRadioGroup` is a Blazor component not an HTML element. – T.Trassoudaine Jan 23 '23 at 15:21

1 Answers1

1

Wrap the <InputRadioGroup> in a <fieldset> and disable that.

<fieldset disabled="@true">
    <InputRadioGroup @bind-Value="answer">
        @foreach (var option in Question.Options)
        {
            <label class="me-3 form-check-label">
                <InputRadio class="form-check-input me-1" Value="@option" />
                @option
            </label>
        }
    </InputRadioGroup>
</fieldset>

The <InputRadioGroup> does not output any HTML. It outputs a CascadingValue CascadingValue<InputRadioContext> and its ChildContent only.

Source Code

Brian Parker
  • 11,946
  • 2
  • 31
  • 41