Data binding
Bind inputs to fields with @bind and respond to events with @on.
@bind
@bind keeps an input and a field in sync — it reads the value and writes it back on change.
<input @bind="name" @bind:event="oninput" />
<p>Hello, @name</p>
@code { private string name = ""; }Events
Wire DOM events to C# methods with @onclick, @onchange, and friends.
<button @onclick="@(() => count++)">+1</button>
@code { private int count; }