How are input components enabled/disabled in Blazor?

Platform: Blazor| Category: Forms and validation

Use the “Disabled” attribute to disable the input component. In the following example, input and checkbox are disabled on button click.

<button @onclick="@onDisable">Disable</button>

<input type="text" disabled="@isDisable" />

<input type="checkbox" disabled="@isDisable" />

<button disabled="@isDisable">button</button>


@code {

    private bool isDisable { get; set; }

    private void onDisable()
    {
        this.isDisable = true;
    }
}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.